Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
<script src="js/formDataToJson.js"></script>
<script src="js/exemptionQuizHandler.js"></script>
<script src="js/autoGenerateFields.js"></script>

<!-- We participate in the US government's analytics program. See the data at analytics.usa.gov. -->
<script async type="text/javascript" src="https://dap.digitalgov.gov/Universal-Federated-Analytics-Min.js?agency=HHS&subagency=CMS&sitetopic=metadata&siteplatform=GitHubPages" id="_fed_an_ua_tag"></script>

<script type="text/javascript">
createFormComponents()
.then((components) => {
Expand All @@ -34,11 +38,32 @@
components: components,
}).then(function (form) {
window.formIOInstance = form;

// form start must only fire once
let formStartFired = false;
form.on("focus", function () {
if (!formStartFired) {
formStartFired = true;
gas4('form_start', {
'form_name': 'code.json form',
'form_id': 'formio',
'form_destination': window.location.pathname
});
}
});

form.on("submit", function (submission) {
console.log("Form Submission here:", submission);
createCodeJson(submission.data);

gas4('form_submit', {
'form_name': 'code.json form',
'form_id': 'formio',
'form_destination': window.location.pathname,
'form_submit_text': 'Generate code.json metadata'
});
});
});
})
})
.catch((error) => {
console.error("Error creating components:", error);
Expand Down Expand Up @@ -292,6 +317,7 @@ <h2>Complete the entire form to generate the code.json file</h2>
indicates a required field</em></p>
</div>

<!-- Generated Form -->
<div id="formio"></div>

<!-- code.json Generated Output -->
Expand Down
Loading