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

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

Mentor ,
Apr 04, 2018 Apr 04, 2018

Copy link to clipboard

Copied

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

Views

187

Likes

Translate

Translate

Report

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

...

Likes

Translate

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

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

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

Likes

Translate

Translate

Report

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