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="page-content">
  <div class="container-fluid">
    <div id="formio"></div>
  </div>
</div>

JavaScript

Formio.createForm(document.getElementById('formio'), 'https://examples.form.io/example').then((form) => {
  // the `initialize` event fires when we're initialized
  form.on("initialized", () => console.log("Initialized!"));
  
  // the `render` event has already fired (we're rendered!) but will
  // fire again if we redraw 
  form.on("render", () => console.log("Rendered!"));
  
  // uncomment the line below to rerender
  /* form.redraw() */;
});