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

PDF Form - Is it possible to link drop down menu to variable text fields?

New Here ,
Nov 09, 2019 Nov 09, 2019

Copy link to clipboard

Copied

I would like to know if there is a JavaScript to do the following - 

 

Drop down list = "Fact" or "Opinion"

Next to each drop down is a text field called "Dislike1" which is a custom entry by user. (they write what they dislike and then use the dropdown to identify if it's a fact or opinion)

If they select Fact for Dropdown1, I would like to replicate "Dislike1" in another text field. If they select Opinion, I would to replicate "Dislike1" into a different text field.

 

The goal is to build a separate list for Facts and a separate list for Opinions, each on separate pages, without user having to retype their Dislikes. Since the lists would build, then the text fields would have to be variable (if they choose Fact 3x in a row, then those text fields go to the Facts page, then if they choose Opinion in the 4th row, that would have to be the first text field on the Opinions page).

 

This may not be possible...but??? The preliminary form is linked below.

Fact vs Opinion PDF Fillable Form 

 

Thank you!

TOPICS
Acrobat SDK and JavaScript

Views

581

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

correct answers 1 Correct answer

Community Expert , Nov 11, 2019 Nov 11, 2019

Hi,

 

I haven't tested this little code yet on my end but you can see if it works.

 

in the Dropdown1 field Properties --> Format tab---> Custom Keystroke Script use something like this :

 

if (!event.willCommit){this.getField("Dislike1").value=event.changeEx;}

 

 

OR,

 


in the Custom Format Script section add something like:

 

if(!event.willCommit)

console.println(!event.value);

 

  • NOTE: make sure to also visit the Options tab and tick the box that says "Commit selected value immediately"


Then in the field that

...

Votes

Translate

Translate
Community Expert ,
Nov 11, 2019 Nov 11, 2019

Copy link to clipboard

Copied

Hi,

 

I haven't tested this little code yet on my end but you can see if it works.

 

in the Dropdown1 field Properties --> Format tab---> Custom Keystroke Script use something like this :

 

if (!event.willCommit){this.getField("Dislike1").value=event.changeEx;}

 

 

OR,

 


in the Custom Format Script section add something like:

 

if(!event.willCommit)

console.println(!event.value);

 

  • NOTE: make sure to also visit the Options tab and tick the box that says "Commit selected value immediately"


Then in the field that you need to copy the contents of the textfield "Dislike1" put a line of code in the custom calculation tab like this:

 

var a = this.getField("Dislike1").value;
var b = this.getField("Dropdown1").value;
if (a=="") event.value = "";
if (b==''") event.value = "";
else if (b==Opinion) event.value = "";
else if (b==Fact) event.value = a;

Votes

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 ,
Nov 18, 2019 Nov 18, 2019

Copy link to clipboard

Copied

Thanks so much - yes, it did work! I have had some issues with the way I designed the form in general so have to change it up a bit. 

Votes

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
Community Expert ,
Nov 18, 2019 Nov 18, 2019

Copy link to clipboard

Copied

LATEST

That is great! you're welcome.

Votes

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