Skip to main content
Known Participant
July 21, 2020
Question

Still cannot figure this out.

  • July 21, 2020
  • 2 replies
  • 825 views

 I have a section with 5 checkbox choices. I need them to start all as required, but once, one of any of the 5 choices is selected, the required and red outline goes away for the other 4 remaining choices please.  I am very confused how to use the .value option for a group of check boxes. I had thought just that alone, would un-red the remailing 4, once any of the others are selected. It should be noted, even though, I want the required red outline to go away, I still want the other 4 boxes to be able to be selected please. 

I am also having a hard time with a simpler one. I have a text box, that if anything is entered, I need a word endered into another text box please. 

Thank you in advance. 

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
July 22, 2020

You can use this code as the custom calculation script of a (hidden) text field:

 

var fields = ["Checkbox1", "Checkbox2"]; // enter the actual field names here
var isFilled = false;
for (var i in fields) {
	var f = this.getField(fields[i]);
	if (f.valueAsString!="Off") isFilled = true;
}
for (var i in fields) {
	var f = this.getField(fields[i]);
	f.required = !isFilled;
}
Bob-DoleAuthor
Known Participant
July 22, 2020

WOW! That is perfect! Danke so much :). Can you give a suggestion for the other part please? 🙂 

try67
Community Expert
Community Expert
July 21, 2020

Do all of these check-boxes have the same name (ie, are they a group)?

Bob-DoleAuthor
Known Participant
July 21, 2020

I had to change the names to be able to select more than one.