VanillaJS Form.io Renderer

by brendanbond

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="jumbotron">
  <div class="container text-center">
    <h1>VanillaJS <a href="https://github.com/formio/formio.js" target="_blank">Form Renderer</a></h1>
    <p>by <a target="_blank" href="https://form.io"><img src="https://help.form.io/assets/formio-logo.png" /></a></p>
  </div>
</div>
<div class="page-content">
  <div class="container-fluid">
    <div id="formio"></div>
  </div>
</div>

JavaScript

Formio.createForm(document.getElementById('formio'), 'https://examples.form.io/example').then(function(form) {
  // Defaults are provided as follows.
  form.submission = {
    data: {
      firstName: 'Joe',
      lastName: 'Smith'
    }
  };

  form.on("render", () => console.log("Rendered!"));
  form.on("")
});