Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update /waitlist/ to include supported diseases / interest checkboxes #671

Merged
merged 7 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions _includes/content/supported-diseases.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<ul>
<ul class="{{ include.styles }}">
{% for disease in site.content.supported_diseases %}
<li>{{ disease }}</li>
{% endfor %}
</ul>


1 change: 1 addition & 0 deletions _pages/getting-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Before you can use SimpleReport, you’ll need to set it up.

SimpleReport supports the following conditions:


{%include content/supported-diseases.html%}

If you're looking for an an easier way to report results, find out [how to sign up]({% link _pages/getting-started/organizations-and-testing-facilities/onboard-your-organization.md %}).
Expand Down
59 changes: 37 additions & 22 deletions pages/forms/waitlist-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h1 class="font-heading-xl text-primary-darker">{{ page.title }}</h1>
>Name {% include required.html %}</label
>
<input
class="usa-input"
class="usa-input form-input"
id="name"
name="name"
type="text"
Expand All @@ -37,7 +37,7 @@ <h1 class="font-heading-xl text-primary-darker">{{ page.title }}</h1>
>Email address {% include required.html %}</label
>
<input
class="usa-input"
class="usa-input form-input"
id="email"
name="email"
type="email"
Expand All @@ -49,18 +49,18 @@ <h1 class="font-heading-xl text-primary-darker">{{ page.title }}</h1>
>Phone number {% include required.html %}</label
>
<input
class="usa-input"
class="usa-input form-input"
id="phone"
name="phone"
type="tel"
autocomplete="tel"
required
/>
<label class="usa-label" for="state" id="state"
>State {% include required.html %}</label
>
<label class="usa-label" for="state">
State {% include required.html %}
</label>
<div class="usa-combo-box">
<select class="usa-select" id="state" name="state" required>
<select class="usa-select form-input" id="state" name="state" required>
{% include forms/state-options.html %}
</select>
</div>
Expand All @@ -71,17 +71,33 @@ <h1 class="font-heading-xl text-primary-darker">{{ page.title }}</h1>
Your facility or the Public Health Department you are representing
</span>
<input
class="usa-input"
class="usa-input form-input"
id="organization"
name="organization"
type="text"
required
/>
<label class="usa-label" for="supported-diseases">Check the boxes below for the conditions you're interested in reporting:</label>
<div class="checkboxes" id="supported-diseases">
{% for disease in site.content.supported_diseases %}
<div class="usa-checkbox">
<input class="usa-checkbox__input form-input" type="checkbox" id="interested in {{disease}}" name="interested in {{disease}}" value="interested in {{disease}}">
<label class="usa-checkbox__label" for="interested in {{disease}}">{{disease}}</label>
</div>
{% endfor %}
</div>
<label class="usa-label" for="additional-conditions">If there are any additional conditions you would like to be able to report
using SimpleReport, please enter them below.</label>
<textarea
class="usa-textarea height-10 form-input"
id="additional-conditions"
name="additional-conditions"
></textarea>
<label class="usa-label" for="referral">How did you hear about us?</label>
<textarea
class="usa-textarea height-10"
id="referral"
name="referral"
class="usa-textarea height-10 form-input"
id="referral"
name="referral"
></textarea>
<p class="margin-bottom-0">
By submitting this form, you agree to our
Expand Down Expand Up @@ -109,18 +125,17 @@ <h3 class="usa-alert__heading">Error</h3>
const form = document.getElementById("waitlist-form");
form.onsubmit = async (e) => {
e.preventDefault();
const fields = [
"name",
"email",
"phone",
"state",
"organization",
"referral",
];

const fieldsToCheck = Array.from(document.getElementsByClassName("form-input"))
Copy link
Contributor

@fzhao99 fzhao99 Mar 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the form input classes were added to the waitlist forms that mattered so that we can grab all of them together using getElementsByClassName

const data = {};
fields.forEach(
(field) => (data[field] = document.getElementById(field).value)
fieldsToCheck.forEach(
(element) => {
if(element.type === "checkbox"){
data[element.name] = element.checked;
}
else {
data[element.name] = element.value;
}
}
);

try {
Expand Down
Loading