Simple Form with Translations
by brendanbond
HTML
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
/>
<link rel="stylesheet" href="https://cdn.form.io/js/formio.full.min.css" />
<script src="https://cdn.form.io/js/formio.full.js"></script>
<div class="container">
<div id="formio"></div>
<div id="otherApplicationStuff"></div>
</div>
JavaScript
const externalData = "Hello, world!"
Formio.createForm(document.getElementById("formio"), {
display: "form",
components: [
{
type: "button",
action: "event",
event: "myCustomEvent",
label: "Press Me",
key: "pressMe",
disableOnInvalid: true,
input: true,
tableView: false,
},
],
}).then((form) => {
form.on("myCustomEvent", () => {
document.getElementById("otherApplicationStuff").innerHTML = "<p>Wow, my custom event fired from within my form, and I can handle it within my application!</p>";
setTimeout(() => {
document.getElementById("otherApplicationStuff").innerHTML = "";
}, 1000);
})
})