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

Autocomplete text box based on dependent dropdown choice

New Here ,
Sep 07, 2022 Sep 07, 2022

Hello!

I am building a form with multiple dropdown lists and text boxes. 

One of the dropdown is dependent on a previous dropdown (the available choices in the 2nd change based on what is selected in the 1st). 

I have a text box that autopopulates based on the response to dropdown1. Works great.

My problem starts with the second text box that should be autocompleted based on what is selected in dropdown 2 (I hope I am making sense). Since the item list in the second dropdown is not pre-determined, I can't set the Export Value in advance.

Have been looking all over for a solution, but have not been able to find one. 

 

Any ideas?

TOPICS
How to , PDF forms
1.2K
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
Adobe Employee ,
Sep 07, 2022 Sep 07, 2022

Hi @Rotem26005237hpuw,

 

Hope you are doing well. Per the description, I understand that you want to the auto-populate the field using multiple drop downs.

 

You can try adding the command GetItemsAt() to get the values from the second drop-down and then populate the text field.

 

You may refer to the link for more: How do you use a selection from a drop down menu to auto populate a selection in a textbox. (JavaScr...

 

Hope this helps.

 

-Souvik.

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 ,
Sep 07, 2022 Sep 07, 2022

Thank you @S. S . The link provided indeed describes how I got a text box to autopopulate from the initial dropdown list. My problem is the second dropdown list doesn't have Items defined in it. Rather, the first dropdown contains a script that determines what options will appear in the second dropdown based on what is selected in the first dropdown. Therefore, I am not clear on how to autofil the second text box if I don't have Items and Export Value defined for the second dropdown. I hope now the problem is clearer. Any help would be appriciated.

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 ,
Sep 07, 2022 Sep 07, 2022

I assume you are using script in second text field as calculation, instead adapt script and use it in second dropdown field as 'validation' script.

If you still have trouble, please share your file.

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 ,
Sep 07, 2022 Sep 07, 2022
LATEST

It will be helpful if you can share your current script or a copy of that PDF to assist you better.

 

From the way you've described your requirement it sounds like you already have hardcoded the values that need to be displayed on the second dropdown field. However, Are you asking to just display  in that second combobox the export value of a selection made in combobox1 or are you asking to also insert that event value as an listed item in dropdown2?

 

There are plenty of scripts and methods that can takle care of that, but we are unclear of what needs to happen.

 

For example, are users allowed to enter custom text in both dropdown menus?  If yes, what do you need to happen with custom entries?

 

On the other hand, using the changeEx keystroke method that is referenced in the link that above, it only pushes out the export value of whatever item is selected from dropdown1 to dropdown2; dropdown2 will just display that export value as its event value and nothing else.

 

If you need to make a current selection of dropdown1 immediately available  in dropdown2 and include it as a list item with the same (or a different) export value,  you must modify the keystroke script with other property methods, such as insertItemAt(), or a combination of getItemAt() with "currentValueIndices".

 

See examples here: Combo box fields 

 

 

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