Copy link to clipboard
Copied
I'm using Adobe Acrobat Pro DC and creating a form. I have a set of 2 radio buttons with a group name of "FMLA Choice". The radio button choices are Yes and No. If the user selects Yes, I want a text box called "Field1" to appear. If the user selects No, I want a text box called "Field2" to appear. If the user does not select either radio button, I want neither of the text boxes to show.
Using the code below, I can get the text boxes to appear if the user selects Yes or No, but I can't get the text fields to stay hidden if neither choice is selected. I have the code as an Action on Mouse Up - Run a JavaScript - on both radio buttons. I think I'm missing something obvious.
var Q = this.getField("FMLA Choice");
var A = this.getField("Field1");
var B = this.getField("Field2");
if (Q.value === "") {
A.hidden = true;
B.hidden = true;
}if (Q.value === "Yes") {
A.hidden = false;
B.hidden = true;
}
if (Q.value === "No") {
A.hidden = true;
B.hidden = false;
}
You can use this code as Custom Calculation Script of both fields:
var Q = this.getField("FMLA Choice");
if(Q != "Yes" && Q != "No"){
event.target.display = display.hidden;}
Copy link to clipboard
Copied
You can use this code as Custom Calculation Script of both fields:
var Q = this.getField("FMLA Choice");
if(Q != "Yes" && Q != "No"){
event.target.display = display.hidden;}