(function (app) { 'use strict'; function boot() { app.context = app.modules.context.load(); if (app.context.title) { const t = document.getElementById('form-title'); if (t) { t.textContent = app.context.title; } document.title = app.context.title + ' — ZDDC'; } const root = document.getElementById('form-root'); if (root && app.context.schema) { app.rootWidget = app.modules.render.mount( root, app.context.schema, app.context.ui || {}, app.context.data ); } if (app.context.errors && app.context.errors.length) { app.modules.errors.apply(app.context.errors); app.modules.post.showStatus('Please correct the errors below.', 'error'); } const submitBtn = document.getElementById('submit-btn'); if (submitBtn) { submitBtn.addEventListener('click', app.modules.post.submit); } } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', boot, { once: true }); } else { boot(); } })(window.formApp);