Copy link to clipboard
Copied
Copy link to clipboard
Copied
Use this code pattern. Place it as the custom Calculation script of "FEG":
if (event.value=="0") {
this.getField("NameA").display = display.hidden;
this.getField("NameA").required = false;
this.getField("NameB").display = display.hidden;
this.getField("NameB").required = false;
this.getField("NameC").display = display.hidden;
this.getField("NameC").required = false;
this.getField("NameD").display = display.hidden;
this.getField("NameD").required = false;
this.resetForm(["NameA", "NameB", "NameC", "NameD"]);
} else if (event.value=="1") {
this.getField("NameA").display = display.visible;
this.getField("NameA").required = true;
this.getField("NameB").display = display.hidden;
this.getField("NameB").required = false;
this.getField("NameC").display = display.hidden;
this.getField("NameC").required = false;
this.getField("NameD").display = display.hidden;
this.getField("NameD").required = false;
this.resetForm(["NameB", "NameC", "NameD"]);
} // etc.
I added to it a command to clear the hidden fields, so you don't get values that shouldn't be there when exporting the form data.
Copy link to clipboard
Copied
Does 225 Value mean 225 is the export value for a selection of 1, and 450 is the export value for a selection of 2, etc.?
Copy link to clipboard
Copied
Yes, that is correct.
Copy link to clipboard
Copied
Use this code pattern. Place it as the custom Calculation script of "FEG":
if (event.value=="0") {
this.getField("NameA").display = display.hidden;
this.getField("NameA").required = false;
this.getField("NameB").display = display.hidden;
this.getField("NameB").required = false;
this.getField("NameC").display = display.hidden;
this.getField("NameC").required = false;
this.getField("NameD").display = display.hidden;
this.getField("NameD").required = false;
this.resetForm(["NameA", "NameB", "NameC", "NameD"]);
} else if (event.value=="1") {
this.getField("NameA").display = display.visible;
this.getField("NameA").required = true;
this.getField("NameB").display = display.hidden;
this.getField("NameB").required = false;
this.getField("NameC").display = display.hidden;
this.getField("NameC").required = false;
this.getField("NameD").display = display.hidden;
this.getField("NameD").required = false;
this.resetForm(["NameB", "NameC", "NameD"]);
} // etc.
I added to it a command to clear the hidden fields, so you don't get values that shouldn't be there when exporting the form data.
Copy link to clipboard
Copied
That works wonderfully!
Thank you so much!