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'),

    {
      "_id": "650b5fbbdbfbad26da272544",
      "title": "Parent Form",
      "name": "parentForm",
      "path": "parentform",
      "type": "form",
      "display": "form",
      "tags": [],
      "access": [{
        "type": "read_all",
        "roles": ["5692b920d1028f01000407e4", "5692b920d1028f01000407e5", "5692b920d1028f01000407e6"]
      }],
      "submissionAccess": [],
      "owner": "62fd3a8bbd98f6bddd6b4ebb",
      "components": [
      {
        "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
      },{
        "label": "Address",
        "applyMaskOn": "change",
        "tableView": true,
        "key": "address",
        "type": "textfield",
        "input": true
      }],
      "settings": {},
      "properties": {},
      "project": "5692b91fd1028f01000407e3",
      "controller": "",
      "revisions": "",
      "submissionRevisions": "",
      "_vid": 0,
      "created": "2023-09-20T21:10:19.916Z",
      "modified": "2023-09-20T21:10:19.920Z",
      "machineName": "examples:parentForm",
      "plan": "commercial"
    })
  .then(function(form) {

    form.submission = {
      data: {
        address: "123 Bleeker St.",
        childForm: {
          data: {
            firstName: "Bob",
            lastName: "Dylan"
          }
        }
      }
    }
  });