Help with Required Field dependant in Drop Down Selection
Hi there
I’ve got a slight quirk with a basic JavaScript...
I have a custom calculation script on a date field which is Required by default, but needs to become not Required if one of 2 choices (from a total of 7) is made from a preceding drop down menu.
The script on the date field to be dependantly Required currently is:
if (this.getField(“Choice”).value == “5” || value == “6”) {
event.target.required = false;
}
else {
event.target.required = true;
}
Now, the above DOES work, i.e. if a choice with the export value 5 or 6 is made the date field is no longer Required, however it will not change back to being Required if another option (export value 1,2,3 etc) is then selected.
However, the date field will correctly flick between Required or not Required if I modify the script to only be dependant on a single export value:
if (this.getField(“Choice”).value == “5”) {
event.target.required = false;
}
else {
event.target.required = true;
}
Is there something wrong with the way I have ‘5 or 6’ ??
Hope that makes sense and would massively appreciate a method to fix this!