automatically populate from dropdown field

New Here ,
Mar 07, 2018

Copy link to clipboard

Copied

I would like a text box to automatically populate with a single letter refering to what was chosen in a dropdown menu ? how do i code this please?

drop down                text box

heli 1                              a

heli 2                              b

heli 3                              c

heli 4                              d

TOPICS
Acrobat SDK and JavaScript

Views

193

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

automatically populate from dropdown field

New Here ,
Mar 07, 2018

Copy link to clipboard

Copied

I would like a text box to automatically populate with a single letter refering to what was chosen in a dropdown menu ? how do i code this please?

drop down                text box

heli 1                              a

heli 2                              b

heli 3                              c

heli 4                              d

TOPICS
Acrobat SDK and JavaScript

Views

194

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
Mar 07, 2018 0
Most Valuable Participant ,
Mar 07, 2018

Copy link to clipboard

Copied

Put these letters as the export values of the items in the drop-down, and then use this code as the custom calculation script of the text field:

event.value = this.getField("dropdown").valueAsString;

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...
Mar 07, 2018 1
New Here ,
Mar 07, 2018

Copy link to clipboard

Copied

makes sense but its not working

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...
Mar 07, 2018 0
New Here ,
Mar 07, 2018

Copy link to clipboard

Copied

My bad !!! it works !!!!!! thank you so much

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...
Mar 07, 2018 0
New Here ,
Mar 30, 2018

Copy link to clipboard

Copied

Is there a way once this script is set up to allow the user to overwrite that field with a custom entry?  This works EXCELLENT but there are a few cases in my process where a custom entry into that field would still be necessary at times but it seems that every time I try to enter something in it is just overwritten by the script again.  Thanks for any help you might have!

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...
Mar 30, 2018 0
Most Valuable Participant ,
Mar 30, 2018

Copy link to clipboard

Copied

Add this line of code before the current one:

if (event.source && event.source.name=="dropdown")

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...
Mar 30, 2018 2
New Here ,
Mar 30, 2018

Copy link to clipboard

Copied

Excellent!!! You just made my day.  Thanks! I'm not very good at code at all (meaning I have no idea what I'm doing ever) but this worked great.  Thanks a lot!

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...
Mar 30, 2018 0