Copy link to clipboard
Copied
I am trying to create a fillable document with multiple tiers with check boxes, and if any of the check boxes in that tier is selected, I would like the narrative field below that tier to become required.
For example:
Tier 1:
Tier 2:
What I'm looking for is if any of Sections 1-5 are selected, Tier 1 Narrative becomes required, and if any of Selections 6-10 are selected, tier 2 narrative becomes required, and so on and so forth.
Copy link to clipboard
Copied
Let's say checkboxes are named "Selection 1" to 5, use this as custom calculation script of Tier 1 text field:
var req = false;
for(var i=1; i<=5; i++){
var f = this.getField("Selection "+i).valueAsString;
if(f !== "Off")
req = true;}
event.target.required = req;
For other tiers, adjust loop like this for tier 2: for(var i=6; i<=10; i++){
Copy link to clipboard
Copied
Be aware the required property is only enforced when the file is submitted, not when saved, printed, emailed, etc.