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

Text field not fillable unless specific menu option is chosen

New Here ,
May 02, 2022 May 02, 2022

I searched the forum for this - and apologize if an answer is out there.

 

I created a PDF that has a dropdown menu called "Options"...with 12 options.

 

One of the drop down options is PIII and I have three fillable text fields that correspond with that option:

 

Type of PIII Funding
YOF
PIII CF

 

What I would like to do is have those text fields not fillable/"locked" - unless the user chooses PIII from the drop down menu.

 

Thank you in advance for any assistance.

TOPICS
Acrobat SDK and JavaScript , Windows
465
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 ,
May 02, 2022 May 02, 2022

As custom calculation script of dropdown field use this:

if(event.value == "PIII"){
this.getField("Type of PIII Funding").readonly = false;
this.getField("YOF").readonly = false;
this.getField("PIII CF").readonly = false;}
else{
this.getField("Type of PIII Funding").readonly = true;
this.getField("YOF").readonly = true;
this.getField("PIII CF").readonly = true;}

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
New Here ,
May 02, 2022 May 02, 2022

Thank you for the quick response.   The good news, the fields are locked.  The not so good news, after picking PIII - I cannot edits those fields.

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
New Here ,
May 02, 2022 May 02, 2022

User error - I was able to get the code to work. Thank you!!

 

Is there a way to also automatically clear/erase text in the fields, if anything other than PIII is selected from the drop down menu?

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 ,
May 03, 2022 May 03, 2022
LATEST

Yes, replace 'else' part with this:

else{
this.getField("Type of PIII Funding").readonly = true;

this.getField("Type of PIII Funding").value = "";
this.getField("YOF").readonly = true;

this.getField("YOF").value = "";
this.getField("PIII CF").readonly = true;

this.getField("PIII CF").value = "";}

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