The selection changes when using dropdown in a PDF form.

Participant ,
Aug 14, 2017

Copy link to clipboard

Copied

I'm still learning JS.  I would like to have a dropdown menu in a PDF form where the user selects from the dropdown but when he clicks on it, a different output occurs.  Example, user selects "G2 - Security" in the dropdown but "ARNO-G2" is what's displayed on the form.  Is this possible?

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Yes, but why would you want to do that? It's really confusing...

The way to do it is by using a custom Format script to change the selected value into something else. In your case it would be:

if (event.value=="G2 - Security") event.value = "ARNO-G2";

TOPICS
Acrobat SDK and JavaScript, Windows

Views

102

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

The selection changes when using dropdown in a PDF form.

Participant ,
Aug 14, 2017

Copy link to clipboard

Copied

I'm still learning JS.  I would like to have a dropdown menu in a PDF form where the user selects from the dropdown but when he clicks on it, a different output occurs.  Example, user selects "G2 - Security" in the dropdown but "ARNO-G2" is what's displayed on the form.  Is this possible?

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Yes, but why would you want to do that? It's really confusing...

The way to do it is by using a custom Format script to change the selected value into something else. In your case it would be:

if (event.value=="G2 - Security") event.value = "ARNO-G2";

TOPICS
Acrobat SDK and JavaScript, Windows

Views

103

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
Aug 14, 2017 0
Most Valuable Participant ,
Aug 14, 2017

Copy link to clipboard

Copied

Yes, but why would you want to do that? It's really confusing...

The way to do it is by using a custom Format script to change the selected value into something else. In your case it would be:

if (event.value=="G2 - Security") event.value = "ARNO-G2";

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
Reply
Loading...
Aug 14, 2017 0
Participant ,
Aug 14, 2017

Copy link to clipboard

Copied

try67,

It isn't really confusing because we have a form that we have to input the Office Symbol and we don't have all of them memorized.  So when a user in-processes with us, they'll know what directorate they're going to before they know what the Office Symbol is and then I have to look it up and input the Office Symbol that matches the directorate.  It would be easier for them to select the directorate and then the Office Symbol is the output in the window.  However, I just tried that script and nothing happened.  I selected G2 - Security in the dropdown menu and instead of displaying ARNO-G2, it displayed what I selected...G2 - Security.

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
Reply
Loading...
Aug 14, 2017 0
Most Valuable Participant ,
Aug 15, 2017

Copy link to clipboard

Copied

Make sure you tick the option to commit the field's selected value immediately, under its Properties - Options tab.

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
Reply
Loading...
Aug 15, 2017 0
Participant ,
Aug 17, 2017

Copy link to clipboard

Copied

try67​ It's working sir!  Thank you.  the problem I had was not paying "attention to detail".  You stated in the original comment to use a Custom Format Script and I was putting the script in the Run custom validation script window.

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
Reply
Loading...
Aug 17, 2017 0