Skip to content

Commit c097c24

Browse files
Updated exemption quiz to include results html and js
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
1 parent b92b436 commit c097c24

2 files changed

Lines changed: 109 additions & 73 deletions

File tree

index.html

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<!-- Render the form -->
2929
<script src="js/generateFormComponents.js"></script>
3030
<script src="js/formDataToJson.js"></script>
31+
<script src="js/exemptionQuizHandler.js"></script>
3132
<script src="js/autoGenerateFields.js"></script>
3233
<script type="text/javascript">
3334
createFormComponents()
@@ -61,80 +62,79 @@
6162

6263
<div id="exemptions">
6364
<p id="exemptions-header"></p>
64-
<form id="exemptions-checklist">
65-
<fieldset class="usa-fieldset">
66-
<div class="usa-checkbox">
67-
<input class="usa-checkbox__input" id="check-national-security-systems" type="checkbox"
68-
name="national-security-systems" value="exemptedByNationalSecurity">
69-
<label class="usa-checkbox__label" for="check-national-security-systems">
70-
Is the project primarily for use in national security systems, as defined in Section 11103 of
71-
title 40, USC?</label>
72-
</div>
73-
<div class="usa-checkbox">
74-
<input class="usa-checkbox__input" id="check-intelligence-community" type="checkbox"
75-
name="intelligence-community" value="exemptedByIntelligence">
76-
<label class="usa-checkbox__label" for="check-intelligence-community">Is the project created by an
77-
agency or part of an agency that is an element of the intelligence community, as defined in
78-
section 3(4) of the National Security Act of 1947?</label>
79-
</div>
80-
<div class="usa-checkbox">
81-
<input class="usa-checkbox__input" id="check-freedom-information-act" type="checkbox"
82-
name="freedom-information-act" value="exemptByFOIA">
83-
<label class="usa-checkbox__label" for="check-freedom-information-act">Is the project exempt under
84-
section 552(b) of title 5, USC (commonly known as the
85-
"Freedom of Information Act")?</label>
86-
</div>
87-
<div class="usa-checkbox">
88-
<input class="usa-checkbox__input" id="check-EAR" type="checkbox"
89-
name="export-administration-regulations" value="exemptByEAR">
90-
<label class="usa-checkbox__label" for="check-EAR">Is the project prohibited under Export
91-
Administration Regulations?</label>
92-
</div>
93-
<div class="usa-checkbox">
94-
<input class="usa-checkbox__input" id="check-ITAR" type="checkbox"
95-
name="international-traffic-in-arms-regulations" value="exemptByITAR">
96-
<label class="usa-checkbox__label" for="check-ITAR">Is the project prohibited under International
97-
Traffic in Arms Regulations (ITAR)?</label>
98-
</div>
99-
<div class="usa-checkbox">
100-
<input class="usa-checkbox__input" id="check-TSA" type="checkbox" name="regulations-of-tsa"
101-
value="exemptedByTSA">
102-
<label class="usa-checkbox__label" for="check-TSA">Is the project prohibited under Regulations of
103-
the Transportation Security Administration related to the protection of sensitive information?
104-
</label>
105-
</div>
106-
<div class="usa-checkbox">
107-
<input class="usa-checkbox__input" id="check-classified-information" type="checkbox"
108-
name="classified-information" value="exemptByClassifiedInformation">
109-
<label class="usa-checkbox__label" for="check-classified-information">Is the project prohibited
110-
under federal laws and regulations governing the sharing of
111-
classified information? </label>
112-
</div>
113-
<div class="usa-checkbox">
114-
<input class="usa-checkbox__input" id="check-privacy" type="checkbox"
115-
name="export-administration-regulations" value="exemptByPrivacyRisk">
116-
<label class="usa-checkbox__label" for="check-privacy">
117-
Does the source code create an identifiable risk to the privacy of an individual?</label>
118-
</div>
119-
<div class="usa-checkbox">
120-
<input class="usa-checkbox__input" id="check-none" type="checkbox" name="none" value="none">
121-
<label class="usa-checkbox__label" for="check-none">None of the above </label>
122-
</div>
123-
</fieldset>
124-
<br>
125-
<button type="submit" class="usa-button">
126-
Submit
127-
</button>
128-
</form>
129-
</div>
130-
131-
<div class="results" style="display: none;">
132-
<div class="results-container">
133-
<img src="assets/images/tier0-tree.svg" class="tree-graphic" alt="Tree graphic">
134-
<p class="tier-result">Your project is: </p>
135-
<br>
65+
<div class="exemptions-quiz-container">
66+
<div id="exemptions-quiz">
67+
<fieldset class="usa-fieldset">
68+
<div class="usa-checkbox">
69+
<input class="usa-checkbox__input" id="check-national-security-systems" type="checkbox"
70+
name="exemption-condition" value="exemptedByNationalSecurity">
71+
<label class="usa-checkbox__label" for="check-national-security-systems">
72+
Is the project primarily for use in national security systems, as defined in Section 11103
73+
of title 40, USC?</label>
74+
</div>
75+
<div class="usa-checkbox">
76+
<input class="usa-checkbox__input" id="check-intelligence-community" type="checkbox"
77+
name="exemption-condition" value="exemptedByIntelligence">
78+
<label class="usa-checkbox__label" for="check-intelligence-community">Is the project created by
79+
an agency or part of an agency that is an element of the intelligence community, as defined
80+
in section 3(4) of the National Security Act of 1947?</label>
81+
</div>
82+
<div class="usa-checkbox">
83+
<input class="usa-checkbox__input" id="check-freedom-information-act" type="checkbox"
84+
name="exemption-condition" value="exemptByFOIA">
85+
<label class="usa-checkbox__label" for="check-freedom-information-act">Is the project exempt
86+
under section 552(b) of title 5, USC (commonly known as the "Freedom of Information
87+
Act")?</label>
88+
</div>
89+
<div class="usa-checkbox">
90+
<input class="usa-checkbox__input" id="check-EAR" type="checkbox" name="exemption-condition"
91+
value="exemptByEAR">
92+
<label class="usa-checkbox__label" for="check-EAR">Is the project prohibited under Export
93+
Administration Regulations?</label>
94+
</div>
95+
<div class="usa-checkbox">
96+
<input class="usa-checkbox__input" id="check-ITAR" type="checkbox" name="exemption-condition"
97+
value="exemptByITAR">
98+
<label class="usa-checkbox__label" for="check-ITAR">Is the project prohibited under
99+
International Traffic in Arms Regulations (ITAR)?</label>
100+
</div>
101+
<div class="usa-checkbox">
102+
<input class="usa-checkbox__input" id="check-TSA" type="checkbox" name="exemption-condition"
103+
value="exemptedByTSA">
104+
<label class="usa-checkbox__label" for="check-TSA">Is the project prohibited under Regulations
105+
of the Transportation Security Administration related to the protection of sensitive
106+
information?
107+
</label>
108+
</div>
109+
<div class="usa-checkbox">
110+
<input class="usa-checkbox__input" id="check-classified-information" type="checkbox"
111+
name="exemption-condition" value="exemptByClassifiedInformation">
112+
<label class="usa-checkbox__label" for="check-classified-information">Is the project prohibited
113+
under federal laws and regulations governing the sharing of classified information? </label>
114+
</div>
115+
<div class="usa-checkbox">
116+
<input class="usa-checkbox__input" id="check-privacy" type="checkbox" name="exemption-condition"
117+
value="exemptByPrivacyRisk">
118+
<label class="usa-checkbox__label" for="check-privacy">
119+
Does the source code create an identifiable risk to the privacy of an individual?</label>
120+
</div>
121+
<div class="usa-checkbox">
122+
<input class="usa-checkbox__input" id="check-none" type="checkbox" name="exemption-condition"
123+
value="none">
124+
<label class="usa-checkbox__label" for="check-none">None of the above </label>
125+
</div>
126+
</fieldset>
127+
<button type="button" onclick="determineExemptions()">Submit</button>
128+
<br>
129+
</div>
130+
</div>
131+
<div class="results" style="display: none;">
132+
<div class="results-container">
133+
<p class="exemption-result">Your project </p>
134+
<br>
135+
</div>
136+
<a href="#" class="doc-link" onclick="handleClick(event)">Try Again</a>
136137
</div>
137-
<a href="#" class="doc-link" onclick="handleClick(event)">Try Again</a>
138138
</div>
139139

140140
<div id="notification" style="display: none;">

js/exemptionQuizHandler.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
function determineExemptions() {
2+
const quiz = document.querySelector(".exemptions-quiz");
3+
const quizContainer = document.querySelector(".exemptions-quiz-container");
4+
const resultsContainer = document.querySelector(".results");
5+
const exemptionResult = document.querySelector(".exemption-result");
6+
7+
const checkedValues = Array.from(
8+
document.querySelectorAll("input[name='exemption-condition']:checked")
9+
).map((input) => input.value);
10+
11+
console.log("Selected answers:", checkedValues);
12+
13+
// Display results
14+
quizContainer.style.display = "none";
15+
resultsContainer.style.display = "block";
16+
exemptionResult.innerHTML = `Your project is: <strong>EXEMPTED</strong><br />
17+
<p>This will be denoted by. The field has been filled out according in the form below.</p>`;
18+
}
19+
20+
function uncheckAllCheckboxes() {
21+
const checkboxes = document.querySelectorAll(".usa-checkbox__input");
22+
checkboxes.forEach((checkbox) => {
23+
checkbox.checked = false;
24+
});
25+
}
26+
27+
function handleClick(event) {
28+
const quizContainer = document.querySelector(".exemptions-quiz-container");
29+
const resultsContainer = document.querySelector(".results");
30+
31+
event.preventDefault();
32+
uncheckAllCheckboxes(); // Clear input
33+
34+
resultsContainer.style.display = "none";
35+
quizContainer.style.display = "block";
36+
}

0 commit comments

Comments
 (0)