VanillaJS Form.io Renderer
HTML
<script src="https://unpkg.com/formiojs@latest/dist/formio.full.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/formiojs@latest/dist/formio.full.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div class="page-content">
<div class="container-fluid">
<div id="formio"></div>
</div>
</div>
JavaScript
Formio.createForm(document.getElementById('formio'), { "display": "form", "components": [ { "label": "Select", "widget": "choicesjs", "tableView": true, "multiple": true, "dataSrc": "url", "defaultValue": [ {} ], "data": { "values": [ { "label": "", "value": "" } ], "url": "https://jsonplaceholder.typicode.com/todos", "headers": [ { "key": "", "value": "" } ] }, "dataType": "object", "template": "<span>{{ item.title }}</span>", "selectThreshold": 1, "calculateServer": false, "validate": { "select": false, "multiple": true }, "key": "select", "type": "select", "indexeddb": { "filter": {} }, "searchField": "q", "input": true, "disableLimit": true, "lazyLoad": false }, { "type": "button", "label": "Submit", "key": "submit", "disableOnInvalid": true, "input": true, "tableView": false } ] }).then(function(form) {
// 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);
});
});