Skip to main content
Known Participant
August 14, 2025
Answered

Populate a text field, from a selection choice from a drop-down menu

  • August 14, 2025
  • 2 replies
  • 573 views

Hello there, I have looked at a lot Of posts, but have been unable to find exactly what I'm looking for.

Any help would be much appreciated.

 

I've created a drop-down menu called "2d" The choices are:

 

COLLECTION

REBOOKED

REPAIR

RTB

DAMAGED

CANCELLED

 

All I would like to do, Is whatever drop down choice I have selected, I would like to appear in my text box called "2dd" 

 

An example:

If I select "REPAIR" From the drop-down menu,

I would like "REPAIR" In the text field..

 

If that makes any sense..

I would appreciate any assistance!

Many thanks!

 

 

Correct answer try67

I really appreciate your help, I'm sorry I am tired and I have been at this for six hours... this is either not working or doesn't make any sense to me..

my drop down menu is called "zone0" and in that menu I have 5 dropdown values;

H9

HL

HM

HN

W1

 

then I have 11 (textfield elements) 

1,

2,

and so on... 

 

what JavaScript do I write in the "zone0" (the drop down menu) 

and what do I write in each text field.. 

example "1"

 

 

I really am trying to understand,

please do excuse my ignorance!


Check the JS Console. There are errors because you used the wrong kind of quotes in your code. You must only use straight quotes ( " or ' ), not curly ones ( “ or ” ). Fix that and the code will work just fine.

2 replies

Participating Frequently
August 14, 2025

bless you, thank you so much for your help however I have tried that and it doesn't seem to work, I did find a solution which was this:

 

var f = this.getField("2dd"); // Replace "OutputText" with your text field's name

if (event.value == "COLLECTION") { // Replace "Option 1" with your dropdown item

    f.value = "COLLECTION";

} else if (event.value == "REBOOKED") { // Replace "Option 2" with your dropdown item

    f.value = "REBOOKED";

} else if (event.value == "REPAIR") { // Replace "Option 3" with your dropdown item

    f.value = "REPAIR";

} else if (event.value == "RTB") { // Replace "Option 4" with your dropdown item

    f.value = "RTB";

} else if (event.value == "DAMAGED") { // Replace "Option 5" with your dropdown item

    f.value = "DAMAGED";

} else if (event.value == "CANCELLED") { // Replace "Option 6" with your dropdown item

    f.value = "CANCELLED";

} else {

    f.value = ""; // Clear the text field if no matching option is selected

}

 

 

However I have found another problem that you may be able to help if you dont mind me asking....

I have a drop down menu with 5 drop down items:

H9

HL

HM

HN

W1

 

this drop down menu only appears once, but I would like my choice (example: "HL") to populate across various places (in fact 11 Places)  in my form (its a long form)

 

if this make any sense at all.

so what I am saying is a make my choice in the drop down menu, but my choice with appear in 11 different text fields.

Nesa Nurani
Community Expert
August 14, 2025

Use the script I gave you and place it in dropdown field under validate tab, repeat script 11 times and just change field names in each line of the script.

Participating Frequently
August 14, 2025

I really appreciate your help, I'm sorry I am tired and I have been at this for six hours... this is either not working or doesn't make any sense to me..

my drop down menu is called "zone0" and in that menu I have 5 dropdown values;

H9

HL

HM

HN

W1

 

then I have 11 (textfield elements) 

1,

2,

and so on... 

 

what JavaScript do I write in the "zone0" (the drop down menu) 

and what do I write in each text field.. 

example "1"

 

 

I really am trying to understand,

please do excuse my ignorance!

Nesa Nurani
Community Expert
August 14, 2025

Go to dropdown field 'Validate' tab and enter this script:

this.getField("2dd").value = event.value;