Skip to main content
Participating Frequently
Mar 7, 2018 2:05 PM UTC
Question

automatically populate from dropdown field

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

This topic is closed to new replies. Start a new post to keep the conversation going.

6 replies

Participant
Mar 30, 2018 6:06 PM UTC

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!

Translate
try67
Community Expert
Community Expert
Mar 30, 2018 7:40 PM UTC

Add this line of code before the current one:

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

Translate
Participant
Mar 30, 2018 8:25 PM UTC

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!

Translate
try67
Community Expert
Community Expert
Mar 7, 2018 2:08 PM UTC

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;

Translate
Participating Frequently
Mar 7, 2018 2:19 PM UTC

makes sense but its not working

Translate
Participating Frequently
Mar 7, 2018 2:21 PM UTC

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

Translate