How can we prevent the same name being selected across 4 different dropdowns - RESOLVED

  • AA_C
    Asked on July 10, 2015 at 10:03 PM

    On my form ID=51404652564958 I have 4 dropdown lists for judges.

    The person selects a name from one or all of the lists, depending on how many judges they require for their event.

    Each list has the same names. Right now the same name could be selected 4 times, not good.

    I actually had one sent in today with Judge 1 and Judge 2 being the same person.

    How do I prevent a name from being used more then once.

     

    So if Judge 1 = Judge 2 = Error and If Judge 2 = Judge 3 = Error,  etc.

    I looked at condition options but could not figure out the logic to do it.

     

    Many thanks,

    Robert

     

         

  • Ben
    Replied on July 11, 2015 at 5:41 AM

    The easiest way to do that Robert is to utilize conditions.

    Now, we can not check the dropdown directly, since conditions only show the fields and do not allow us to make custom checks.

    To go around this, we can add the Calculation values to the dropdowns, allowing us to check the numbers associated with each name.

    Now there is a little trick here as well, usually with calculation values you just start with the numbering for each text, but with dropdown there is an empty field shown first, so we always need to add a 0 before and then proceed by adding the other numerical representations (calculation values).

    Now we set up the conditions to check if these 4 fields are matched and if so, we can show the error and for example, remove submit button.

    So the steps:

    1. Add Form Calculation widgets to your jotform (we need 4 of them)

    You can see here how to add it to your form: How to Add a Widget to your Form

    2. Now we set each of them to capture the value of 1 dropdown field

    How can we prevent the same name being selected across 4 different dropdowns   RESOLVED Image 1 Screenshot 50

    - Now we repeat the steps for other dropdowns

    3. Add calculation value to all of them, in our instance we need to add 4 of the same (almost)

    This is the code for judge1 field: https://pastebin.com/baxqkzUg

    You can see here how to add it into Calculation Values: How to Assign Calculation Value

    4. the trick

    - Now we can not add the exact same numbers to all fields, or they would all be the same on the form load, causing the error action to be activated right away, so what we do here is to apply the exact numbers only to the first field (Judge1) and for other 3 dropdowns we change the 0 (and only the 0) into a negative number. For example, -1, -2 and -3.

    So what we have now are 4 numeric lists that only differ in the first numbers where judge 1 dropdown starts with 0, judge 2 with -1, judge 3 with -2 and judge 4 with -3.

    5. Adding the Error text

    I like to add a Text element that wold hold the text explaining that something is not right and how to fix it. I believe this to be the best way to handle any error on your form, so first, add the Text element (found under Form Tools):

    How can we prevent the same name being selected across 4 different dropdowns   RESOLVED Image 2 Screenshot 61

    Now place it under or above the fields (where you want it to show up) and set the text.

    6. Conditions - Now that we have it all set up with the fields we can go onto setting up of the conditions.

    How can we prevent the same name being selected across 4 different dropdowns   RESOLVED Image 3 Screenshot 72

    Now as we have them set up, we click on Save and that is it :)

    Your form is now set up and you should preview it to see how it works.

    The only thing that we should do now is the visual part - making the form calculations hidden and that is just easy.

    Just click on each of them with your right mouse button and select Hide Field option

    How can we prevent the same name being selected across 4 different dropdowns   RESOLVED Image 4 Screenshot 83

    Now your form is looking great and allows you to show an error when same judge is selected in any of the dropdowns.

    I do suggest adding another action to the conditions to hide the submit as well if people continue selecting the same judge which will stop them from making the submission in the first place.

    You can see it in action on this modified clone of your form: http://form.jotformpro.com/form/51912759047966 which you can also clone to your account if you wish, by following the steps here: How to Clone an Existing Form from a URL

    Do let us know of course if you have any issues on any step and we would be happy to assist.

  • AA_C
    Replied on July 11, 2015 at 11:05 AM

    HI Ben.....

    Thank you ... This works PERFECTLY ...

    I need to be able to select TBA in any and all drop down lists. So I set each TBA with a minus value.

    I embed my forms so I can massage them... here is the link to the updated version on our website for you to see.

    http://www.aac.ca/en/forms/TrialApps/

    Thanks again for the Great GREAT Support!

    I have another question about this form... Should I post it separately?

    Robert

  • Welvin Support Team Lead
    Replied on July 11, 2015 at 3:49 PM

    On behalf of my colleague, you are most welcome.

    Yes, please create a new thread for your other question.

    Thanks