Skip to content

Commit

Permalink
Update application.html
Browse files Browse the repository at this point in the history
  • Loading branch information
CannonLock committed Jul 23, 2024
1 parent bd46ca9 commit 8d61a72
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
3 changes: 1 addition & 2 deletions portal/static/js/form.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"])
}
Expand Down
2 changes: 1 addition & 1 deletion portal/static/js/freshdesk.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
33 changes: 32 additions & 1 deletion portal/website/templates/application.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,29 @@ <h3 class="text-center accent-text fw-light">Harness the Capacity of the OSPool<
<label for="collaboration" class="form-label">Is your research project contributing to the science objectives of a multi-institutional collaboration?</label>
<select id="collaboration" name="collaboration" class="form-select">
<option value="Yes">Yes</option>
<option value="No">No</option>
<option value="No" selected>No</option>
<option value="Unsure">Unsure</option>
</select>
</div>
<div id="collaboration-name-container" class="pt-3" hidden>
<label for="collaboration-name" class="form-label">Collaboration Name:</label>
<input type="text" id="collaboration-name" name="collaboration-name" list="collaborations" placeholder="Start typing..." class="form-control" required>
<datalist id="collaborations">
<option value="REDTOP">
<option value="IceCube">
<option value="IGWN">
<option value="LSST">
<option value="South Pole Telescope">
<option value="VERITAS">
<option value="XENON">
<option value="GLUEX">
<option value="CLAS12">
<option value="MOLLER">
<option value="EIC">
<option value="Snowmass">
<option value="KOTO">
</datalist>
</div>
<div class="pt-3">
<label for="computational-requirements" class="form-label">List the typical requirements of your computational workload, if you know - typical data size, computational needs (cores/memory), computational runtime.</label>
<textarea id="computational-requirements" name="computational-requirements" class="form-control" rows="4"></textarea>
Expand Down Expand Up @@ -227,5 +246,17 @@ <h4 class="m-auto accent-text">OSPool Contributor Map</h4>
}
}
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
}
})

</script>
{% endblock %}

0 comments on commit 8d61a72

Please sign in to comment.