Form.io Lazy Load Renderer
by brendanbond
HTML
<script src="https://cdn.form.io/js/formio.embed.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<div class="container">
<div id="formio"></div>
</div>
JavaScript
Formio.setBaseUrl("https://api.form.io");
Formio.setProjectUrl("https://examples.form.io");
Formio.createForm(document.getElementById('formio'),
{
"components": [{
"label": "Address",
"applyMaskOn": "change",
"tableView": true,
"key": "address",
"type": "textfield",
"input": true
}, {
"label": "Child Form",
"tableView": true,
"form": "650b5f6f92cb3f45d02ec791",
"useOriginalRevision": false,
"key": "childForm",
"type": "form",
"input": true
}, {
"type": "button",
"label": "Submit",
"key": "submit",
"disableOnInvalid": true,
"input": true,
"tableView": false
}],
})
.then(function(form) {
setTimeout(() => {
form.submission.data = {
address: "123 Bleeker St.",
childForm: {
data: {
firstName: "Bob",
lastName: "Dylan"
}
}
};
}, 5000)
});