Text field not fillable unless specific menu option is chosen

New Here ,
May 02, 2022 May 02, 2022

Copy link to clipboard

Copied

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

Views

46

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
May 02, 2022 May 02, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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?

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
May 03, 2022 May 03, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

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