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

Assigning a default value to a combo box form field

Engaged ,
Nov 20, 2022 Nov 20, 2022

Looking for a sample script to assign/change a default value for a combo box used to assign the value to a combo box subsequent to using the resetForm() method.

TOPICS
How to , JavaScript , PDF forms
1.3K
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
Engaged ,
Nov 20, 2022 Nov 20, 2022

No need to answer. Resolved.

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
Engaged ,
Nov 21, 2022 Nov 21, 2022

I stand corrected in that the script I had created failed to accomplish the task at hand in which case I also need to rephrase the initial question. The issue I am having is that I would like to prevent the default value of a combo box from changing whenever a user adds a value to the drop down list. While I have created scripts that work flawlessly to allow an end user to add as well as delete an item to/from a combo box, I have yet been able to create a script that retains and prevents a default value from changing whenever a user adds a new value to the drop down list. A script appears to be required since any time a user adds a new value to the list, the default value for the combo box automatically shifts to the top most item in the list. Any suggestions regarding the solution are most appreciated. Thank you ahead of time. 

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
Engaged ,
Nov 21, 2022 Nov 21, 2022

Resolved. Sorry to be a PITA. The script was correct and simple as I had initially thought. It was essentially the placement inside another script causing the problem.

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 ,
Nov 21, 2022 Nov 21, 2022

Just for anyone else who finds this thread, the answer is the default item is the first one that appears in the array you supply to the setItems method as a parameter.

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
Engaged ,
Nov 28, 2022 Nov 28, 2022
LATEST

Understood. In my particular case, the resolve was to implement a script to retain the same default item in a combo box such as 'Select|Add' whenever resetting the form, adding, or deleting an item from a combo box when using a custom popup menu integrated into the form.

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