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

Form with Multiple Drop Down List

Community Beginner ,
Apr 11, 2019 Apr 11, 2019

Copy link to clipboard

Copied

Form.png

I this form for softball positions.  Each position has the same drop down list of players.  Is there a way that when one player is selected for one position, it then eliminates that player from being in other positions and duplicating players in positions by accident.

TOPICS
PDF forms

Views

836

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
Community Expert ,
Apr 11, 2019 Apr 11, 2019

Copy link to clipboard

Copied

Yes, this has to be done with JavaScript. It requires a master script and a master list of players.  The script is run each time any of the dropdowns is changed. It gathers all the selections, eliminates them from a copy of the master list, then sets the new list of players and the current selected value of each list. Note, that during the part where the lists are reset, the calculations must to be turned off to keep the script and other actions from being re-run.

That's all there is to it

]

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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
LEGEND ,
Apr 11, 2019 Apr 11, 2019

Copy link to clipboard

Copied

What happens if you later change a player in one of the previous selected positions?

Votes

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
Community Expert ,
Apr 11, 2019 Apr 11, 2019

Copy link to clipboard

Copied

Right, it has to remove the other selection. It would give priority to the source dropdown.  Any other dropdown with the same player would be set to blank.

I also neglected to mention that each dropdown is set to the filtered player list + the currently selected player.  Where the filtered list is the master list minus all selections.

This stuff is a bit complicated, gotta think through all the possibilities.

Thanks Mr. Kaiseril!!

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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
Community Expert ,
Apr 12, 2019 Apr 12, 2019

Copy link to clipboard

Copied

I would do it differently. Instead of removing values from the lists (which is tricky, because when a selection is changed you then have to go back and add that selection to the other fields, for example), I would use a validation script to reject a selection that was already made in another field. That will also ensure that no duplicate names are selected and is much easier to set up.

Votes

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
Community Expert ,
Apr 12, 2019 Apr 12, 2019

Copy link to clipboard

Copied

LATEST

You misunderstand me. My technique is for everything to flow from the master lists. 

With a validation script the names are still visible to the user.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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