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

How do you reference the export value of a combo box item?

Mentor ,
Apr 04, 2018 Apr 04, 2018

If the event.value of a combo box is the item name of the current selection, then what do you use to reference the current selection's export value?

TOPICS
Acrobat SDK and JavaScript
780
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

correct answers 1 Correct answer

Community Expert , Apr 04, 2018 Apr 04, 2018

Good question. There's no simple way. The most direct way would be to use the currentValueIndices property and the getItemAt method to get it, but that doesn't update until after the validation event, so if you try it you'll get the value from before the change.

The only approach that I found to work is to basically iterate over all the items in the field (using numItems and getItemAt), comparing them to event.value, and if you find a match then use getItemAt again to get the export value of that

...
Translate
Community Expert ,
Apr 04, 2018 Apr 04, 2018

Good question. There's no simple way. The most direct way would be to use the currentValueIndices property and the getItemAt method to get it, but that doesn't update until after the validation event, so if you try it you'll get the value from before the change.

The only approach that I found to work is to basically iterate over all the items in the field (using numItems and getItemAt), comparing them to event.value, and if you find a match then use getItemAt again to get the export value of that index.

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
Mentor ,
Apr 04, 2018 Apr 04, 2018
LATEST

I guess I won't worry about it, then; referencing the item name works fine; it just seemed a little clunky. Thanks.

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