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 id="formio"></div>
JavaScript
Formio.createForm(document.getElementById('formio'), 'https://examples.form.io/example').then(function(form) {
/* // Defaults are provided as follows.
form.submission = {
data: {
firstName: 'Brendan',
lastName: 'Bond',
email: "[email protected]"
}
}; */
// Register for the submit event to get the completed submission.
form.on('submit', function(submission) {
console.log('Submission was made!', submission);
});
// Everytime the form changes, this will fire.
form.on('change', function(changed) {
console.log('Form was changed', changed);
});
});