Copy link to clipboard
Copied
I have 7 radio buttons groups. PD.Q1 to PD.Q7
Each one is Yes or No
I have two text fields. PDW.Warning1 and PDW.Warning2.
Each one is hidden by default.
My objective is to show these warning text boxes based on the result of the radio buttons. The intent is that if any of the radio button groups are selected "Yes", then the warning will appear, regardless of its 1, or all 7. If all of the radio buttons are selected "No", then the warnings will remain hidden.
I wrote this in the calculations of one of the text boxes, and it works, but it has issues.
It shows the hidden warnings, but its a "sequencial" process, meaning when a user checks the first yes, then the second no, it shows, then hides the text boxes.
I need the warning to remain after a "Yes", and only hide when all radio buttons are "No".
if(!event.source || (event.source.name = "PD"))
{
var nHide=(event.source.value=="Yes")?display.visible:display.hidden;
this.getField("PDW").display=nHide;
}
Thanks in Advance!
You must test all 7 radio buttons.
You've almost got the right idea, but there are several issue with your code.
First, this line.
event.source.name = "PD"
is an assignment, not a comparison, And the name of the fieild are only prefixed with "PD" the name is longer so this comparison won't work. The firs t The first line needs to be this
if(!event.source || /^PD\./.test(event.source.name))
Next, all the checkboxes need to be tested. You've named them perfected for this. So here's the complete code.
if(!event.source || /^PD\./
...
Copy link to clipboard
Copied
I also tried this from a 1 and 0 return perspective. But its showing the warning text when the NO/0 value is checked.
var nResult = this.getField("PD").value;
if(nResult=1){
this.getField("PDW").display=display.visible
}
else if (nResult=0){
this.getField("PDW").display.display.hidden
}
Copy link to clipboard
Copied
You must test all 7 radio buttons.
Copy link to clipboard
Copied
You've almost got the right idea, but there are several issue with your code.
First, this line.
event.source.name = "PD"
is an assignment, not a comparison, And the name of the fieild are only prefixed with "PD" the name is longer so this comparison won't work. The firs t The first line needs to be this
if(!event.source || /^PD\./.test(event.source.name))
Next, all the checkboxes need to be tested. You've named them perfected for this. So here's the complete code.
if(!event.source || /^PD\./.test(event.source.name)){
var aFldList = this.getField("PD").getArray();
var nHide= aFldList.some(function(a){return a.value == "Yes";})?display.visible:display.hidden;
this.getField("PDW").display=nHide;
}
Copy link to clipboard
Copied
Beautiful, thank you both so much for the much needed boost. All I got to say is I can't wait for my kids Daycare to open back up.......