Show/hide checkboxes
I have a form with a dropdown ("Decision") with four options that include:
Select one
refuses the parental request for an evaluation.
accepts the parental request for an evaluation.
proposes the evaluation.
I then have 16 checkboxes that should ONLY be visible if one of the two final ones are selected (accepts and proposes). If the dropdown is "Select one" or refuses, they should remain hidden.
I've tried a variety of things, but can't make it work (yes, I used ChatGPT to help me, so I'm sure there are errors, but I can't figure out what they are!).
Most recently, I've tried a Validation Script of
var decisionField = this.getField("Decision");
var checkboxFields = ["Checkbox1", "Checkbox2", "Checkbox3", "Checkbox4", "Checkbox5", "Checkbox6", "Checkbox7", "Checkbox8", "Checkbox9", "Checkbox10", "Checkbox11", "Checkbox12", "Checkbox13", "Checkbox14", "Checkbox15", "Checkbox16"];
var decisionValue = decisionField.value;
for (var i = 0; i < checkboxFields.length; i++) {
var checkbox = this.getField(checkboxFields[i]);
if (decisionValue === "accepts the parental request for an evaluation" || decisionValue === "proposes the evaluation") {
checkbox.display = display.visible;
} else {
checkbox.display = display.hidden;
}
}
It isn't working right. Sometimes it shows the checkboxes and sometimes it doesn't, but it's not clearly based on the response to "Decision." I think perhaps it isn't updating like it should, but don't really know what is going on. Does anyone have suggestions? Thanks!
