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

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

New Here ,
Apr 03, 2023 Apr 03, 2023

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!

TOPICS
How to , JavaScript , PDF forms
523
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Apr 03, 2023 Apr 03, 2023
Translate
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 ,
Apr 03, 2023 Apr 03, 2023
Translate
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 ,
Apr 03, 2023 Apr 03, 2023
LATEST

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";

Translate
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