Skip to main content
Participant
April 9, 2020
Question

How to prevent multiple selections of the same value in multiple fields

  • April 9, 2020
  • 1 reply
  • 362 views

I have a user-input form with a series of questions that have 4 differently ranked answers for each question.  No duplicate ranking is allowed.  Example Question: "My favorite food is:"  Rank these possible answers from 1-4 in order of preference: Apple; Ice Cream: Fish; Wine

 

I'm using Acrobat Pro DC.  Can I create a script under either Calculate or Validate that would make this work?  If so, what would that be?  If not, any suggestion?

 

I have created 4 dropdown boxes for each of the 4 form fields.  They are named: Dropdown1a, Dropdown1b, Dropdown1c, Dropdown1d.  I would create/name the remaining fields as Dropdown2a, Dropdown2b, Dropdown2c, Dropdown2d, and so on.

 

I don't use JavaScript, but here's the simple script that I thought might work:

if(Dropdown1a) not= (Dropdown1b)
if(Dropdown1a) not= (Dropdown1c)
if(Dropdown1a) not= (Dropdown1d)

 

Any help is much appreciated.  Thank you.

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
April 9, 2020

This is not an easy problem to solve for several reasons. However, you'll find a paid for example that shows exactly how to do this here:

https://www.pdfscripting.com/public/Multiple-Lists-Unique-selection-Description.cfm

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