Skip to content

Commit

Permalink
Modify waitlist form to send to SR app backend (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
emyl3 authored Apr 5, 2024
1 parent b88cba2 commit 386f736
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pages/forms/waitlist-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ <h1 class="font-heading-xl text-primary-darker">{{ page.title }}</h1>
<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}}">
<input class="usa-checkbox__input form-input" type="checkbox" id="interested in {{disease}}" name="interested in {{disease}}" value="{{disease}}">
<label class="usa-checkbox__label" for="interested in {{disease}}">{{disease}}</label>
</div>
{% endfor %}
Expand Down Expand Up @@ -127,17 +127,20 @@ <h3 class="usa-alert__heading">Error</h3>
e.preventDefault();
const fieldsToCheck = Array.from(document.getElementsByClassName("form-input"))
const data = {};
const diseaseInterest = [];
fieldsToCheck.forEach(
(element) => {
if(element.type === "checkbox"){
data[element.name] = element.checked;
}
if (element.type === "checkbox" && element.name.includes("interested in")){
if (element.checked) {
diseaseInterest.push(element.value);
}
}
else {
data[element.name] = element.value;
}
}
);

data["disease-interest"] = diseaseInterest;
try {
let response = await fetch("/api/account-request/waitlist", {
method: "POST",
Expand Down

0 comments on commit 386f736

Please sign in to comment.