Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Conditional formatting for radio buttons and text fields.

New Here ,
Sep 11, 2020 Sep 11, 2020

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;

}

TOPICS
PDF forms
3.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Sep 11, 2020 Sep 11, 2020
LATEST

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;}

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 11, 2020 Sep 11, 2020
LATEST

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;}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines