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

compare 2 comboboxes

New Here ,
Sep 09, 2016 Sep 09, 2016

Hi,

I'm using adobe Pro to create a form.

I would like to know how i can compare 2 comboboxes. This is needed to prevent that the user makes a combination that is not possible.

Ex.

Combobox1 has the values A, B, C, D and Combobox 2 has the values C, D, E, F.

The user can only combine C+D and D+E but not A+C, A+B, .....etc.

How do i do this in code. I added the export values since i think this can be used for this purpose.

TOPICS
Acrobat SDK and JavaScript , Windows
368
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 09, 2016 Sep 09, 2016

Your approach to this task is wrong, I think.

What you really should be doing is to populate the second drop-down field with just the valid values, based on the selection in the first field. That way there can't be an invalid selection.

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 09, 2016 Sep 09, 2016

OK, that is a good tip. But how do i do that then?

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 09, 2016 Sep 09, 2016

That requires using a script. The basic structure of that script would be something like this (as the custom validation code of the first drop-down);

if (event.value=="A") this.getField("Dropdown2").setItems(["X", "Y", "Z"]);

else if (event.value=="B") this.getField("Dropdown2").setItems(["XX", "YY", "ZZ"]);

etc.

If you're interested, I've developed a tool that allows you to set such a thing up quite easily, without having to write any code yourself.

You can find it here: Custom-made Adobe Scripts: Acrobat -- Create Dependent Dropdowns

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 09, 2016 Sep 09, 2016
LATEST

This solved my problem. Thank you.

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