Copy link to clipboard
Copied
Can someone please assist in script that would make a text field called PLAN mandatory to fill up with the following conditions?:
If 5 or more of the radio buttons in the RED column are selected, the text PLAN has to be mandatory
Also
If 7 or more of the BLUE column are selected, the text field PLAN has to be mandatory
All sets of radio button are called in groups as per the first column, the RED column has a value of 1 and the BLUE an option of 5.
I truly appreciate your help. And Thanks!!
I assume numbers on the left are radio button names (1.1, 1,2...etc), use this script in "PLAN" field as custom calculation script under 'Calculate' tab:
var fields = ["1.1","1.2","1.3","1.4","2.1","2.2","2.3","3.1","3.2","3.3","4.1","4.2","5.1","6.1","6.2","6.3","6.4","6.5","7.1","8.1"];
var red = 0;
var blue = 0;
for(var i=0; i<fields.length; i++){
var f = this.getField(fields[i]).valueAsString;
if(f === "1")red++;
if(f === "5")blue++;}
event.target.required = (red>=5 || blue>=7) ? true
...
Copy link to clipboard
Copied
I forgot to clarify that all 20 questions have to be selected in one of the columns with the radio buttons.
Copy link to clipboard
Copied
I assume numbers on the left are radio button names (1.1, 1,2...etc), use this script in "PLAN" field as custom calculation script under 'Calculate' tab:
var fields = ["1.1","1.2","1.3","1.4","2.1","2.2","2.3","3.1","3.2","3.3","4.1","4.2","5.1","6.1","6.2","6.3","6.4","6.5","7.1","8.1"];
var red = 0;
var blue = 0;
for(var i=0; i<fields.length; i++){
var f = this.getField(fields[i]).valueAsString;
if(f === "1")red++;
if(f === "5")blue++;}
event.target.required = (red>=5 || blue>=7) ? true : false;
Copy link to clipboard
Copied
Thank you very much!!