Skip to main content
Participant
April 3, 2023
Answered

Forms Javascript help : I want drop down result to fill Text box with a certain text

  • April 3, 2023
  • 1 reply
  • 609 views

Hi, I'm very new at creating Javascript.

 

I have a drop down selection that goes from numbers 1 to 6.

 

If the user selects number 1 in the drop-down, I want a Text field box to say a specific text.

To make it easier lets say:

Drop down says 1, Text field says A

Drop down says 2, Text Says B

Dropdown say 3, text says C

 

It sounds easy but I can't figure it out!

This topic has been closed for replies.

1 reply

Bernd Alheit
Community Expert
Bernd AlheitCommunity ExpertCorrect answer
Community Expert
April 3, 2023
Participant
April 3, 2023

Thanks, that's really helpful. Its all working. I ended up with:


var vDropdown1 = this.getField("Dropdown1").valueAsString;
if (vDropdown1=="Select one") event.value = "";
else if (vDropdown1=="1") event.value = event.value + "TEXT-A";
else if (vDropdown1=="2") event.value = event.value + "TEXT-B";
else if (vDropdown1=="3") event.value = event.value + "TEXT-C";
else if (vDropdown1=="4") event.value = event.value + "TEXT-D";
else if (vDropdown1=="5") event.value = event.value + "TEXT-E";
else if (vDropdown1=="6") event.value = event.value + "TEXT-F";