From 8d61a727d9e54800cbb9783f0d7a49d37c8c4601 Mon Sep 17 00:00:00 2001 From: Cannon Lock Date: Tue, 23 Jul 2024 15:34:22 -0500 Subject: [PATCH] Update application.html --- portal/static/js/form.mjs | 3 +-- portal/static/js/freshdesk.mjs | 2 +- portal/website/templates/application.html | 33 ++++++++++++++++++++++- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/portal/static/js/form.mjs b/portal/static/js/form.mjs index 22fd6dc..aa79152 100644 --- a/portal/static/js/form.mjs +++ b/portal/static/js/form.mjs @@ -6,7 +6,7 @@ export const validateForm = (form) => { // Check that all input validity for (const el of form.querySelectorAll("[required]")) { - if (!el.reportValidity()) { + if (!el.reportValidity() && isVisible(el)) { errorNode.textContent = "Please fill out all elements in the form, if not applicable you can write 'NA'."; errorNode.hidden = false; return false; @@ -34,7 +34,6 @@ export const getFormData = (form) => { // Create default inputs for elements that are not reported if values are none let defaults = Array.from(form.getElementsByTagName("input")).reduce((currentValue, element) => { - console.log(element) if(element.type == "checkbox"){ currentValue.push([element.name, "off"]) } diff --git a/portal/static/js/freshdesk.mjs b/portal/static/js/freshdesk.mjs index 752018a..f2b6719 100644 --- a/portal/static/js/freshdesk.mjs +++ b/portal/static/js/freshdesk.mjs @@ -139,7 +139,7 @@ export const formDataToFreshDescription = (formData) => { return Object.entries(formData).reduce((pv, [k, v]) => { - if(skipKeys.has(k)){ + if(skipKeys.has(k) || !v['label']){ return pv } diff --git a/portal/website/templates/application.html b/portal/website/templates/application.html index 63f6095..332cd70 100644 --- a/portal/website/templates/application.html +++ b/portal/website/templates/application.html @@ -116,10 +116,29 @@

Harness the Capacity of the OSPool< +
@@ -227,5 +246,17 @@

OSPool Contributor Map

} } document.addEventListener('shown.bs.popover', hidePopover) + + // If select with id 'collaboration' is 'Yes', show the 'collaboration-information-container' element + let collaborationSelect = document.getElementById("collaboration") + let collaborationNameContainer = document.getElementById("collaboration-name-container") + collaborationSelect.addEventListener("change", (e) => { + if(e.target.value === "Yes"){ + collaborationNameContainer.hidden = false + } else { + collaborationNameContainer.hidden = true + } + }) + {% endblock %} \ No newline at end of file