How to make radio buttons make text field visible depending on two groups of radio buttons? I am very new to JavaScript and need some guidance. I am creating a PDF form using LiveCycle Designer ES3, I have two questions both with Yes/No answers using radio buttons. The radio buttons are on different groups. I need a text field to be visible if both answers are No and if any answers are switched to Yes then make the text field invisible. So far I have the following but I know it is not right. Your help is appreciated.
Lets say I named one group of radio buttons mulChoice1 and the other mulChoice2 and the text field as textField. I entered the code on the click* event, should this be here or on the exit* event? (I know I need to change when I place it in the mulChoice2 group.) I did bind the answers, Yes = 1 and No = 2.
//if no is clicked then make text field visible
if (this.rawValue == "2") {
if (Page1.Content.mulChoice2.rawValue == "2" ) {
Page1.Content.textField.presence = "visible";
} else if (this.rawValue == "1") {
Page1.Content.textField.presence = "invisible";
}
else (this.rawValue == null) {
Page1.Content.textField.presence = "invisible";
}
Thanks again for any help.
Solved! Go to Solution.
Views
Replies
Total Likes
MinusZero Thank you for the guidance, I used the following code and it works as it should. In addition, I only had to place the code in each of the radio button groups not on each radio button.
if (Page1.Content.mulChoice1.rawValue == "2" & Page1.Content.mulChoice2.rawValue == "2")
{
Page1.Content.textField.presence = "visible";
}
else if (Page1.Content.mulChoice1.rawValue == "1" || Page1.Content.mulChoice2.rawValue == "1")
{
Page1.Content.textField.presence = "invisible";
}
Views
Replies
Total Likes
Hi,
You will need to place the code in the click event of all radio button items. The null code wouldnt be needed then, when you click the other button in the group, it will re-execute the code. Your suggested code and my example below doesnt handle if one is yes and one is no.
You can use the same code in all 4 click events (javascript).
if(Page1.Content.mulChoice1.rawValue == "2" & Page1.Content.mulChoice2.rawValue == "2")
{
Page1.Content.textField.presence = "visible";
}
if(Page1.Content.mulChoice1.rawValue == "1" & Page1.Content.mulChoice2.rawValue == "1")
{
Page1.Content.textField.presence = "invisible";
}
Views
Replies
Total Likes
MinusZero Thank you for the guidance, I used the following code and it works as it should. In addition, I only had to place the code in each of the radio button groups not on each radio button.
if (Page1.Content.mulChoice1.rawValue == "2" & Page1.Content.mulChoice2.rawValue == "2")
{
Page1.Content.textField.presence = "visible";
}
else if (Page1.Content.mulChoice1.rawValue == "1" || Page1.Content.mulChoice2.rawValue == "1")
{
Page1.Content.textField.presence = "invisible";
}
Views
Replies
Total Likes
Glad to help.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies