How to combine show / hide and If-else conditions in a Text Field based on Checkbox Selections
I am working on a pavilion rental form and having trouble with code in one specific section.
There is a "total" text field that will reflect a dollar value. The value is determined by which checkbox "pavilion" a user wants to rent. The if-else conditions I created for this work as I intend.
event.value = 0;
if (this.getField("Roller Hockey").value!="Off") event.value=53;
else if (this.getField("Tot Lot").value!="Off") event.value=53;
else if (this.getField("VP Large").value!="Off") event.value=80;
else if (this.getField("Submarine").value!="Off") event.value=53;
else if (this.getField("Mermaid").value!="Off") event.value=53;
else if (this.getField("TSC Large").value!="Off") event.value=80;
else event.value = "0";
However, there are separate checkboxes for the time period a person wishes to rent, since they are booked in half-day periods. I want the "total" text field and value from the if-else conditions to show or hide based on which time period is selected.
if (this.getField("8 AM – 12 PM").value != "Off") {
this.getField("Total1").hidden = false;
} else {
this.getField("Total1").hidden = true;
}
I can get both codes to work individually, but I don't know how to combine them so they can run together. I am fairly new to JavaScript and learning as I go along. Any help would be greatly appreciated.
