I need to set a max # of options and have an error flag for excess choices

  • Profile Image
    nystea
    Asked on August 24, 2016 at 06:17 PM

    I have this form built for an election: https://www.jotform.com//?formID=62366246659971

    It adds the vote per candidate to the submission and has a maximum number of votes to be cast. This all works correctly. I want an error flag to pop up if they select more than the maximum. That works, but I have to change the number in several places. 

    My goal is to make this scalable for the future. I created the field {setMaximum} at the top of the form. I want it to control the appearance of the hidden error fields  AND change the content of those hidden fields.

    Example: {setMaximum} = 5   When the 6th checkbox is selected, the hidden error fields will pop up with 

    Please select no more than {setMaximum} candidates.

    and the Submit button will be hidden.

    As the board elections continue through the years, different numbers of candidates will run with a different max. I don't want to have to change all the error flags each time. I also don't want a generic "you've selected too many..." as the general public isn't smart enough to do math and figure out what works. I also know that I won't always be the tech guy for this group and I want it easy to pass on.

    I feel like I'm almost there. Inserting a variable into the text should just require knowing the syntax. Perhaps I've been in front of the computer too long today.

    Thanks for your help!

  • Profile Image
    Mike
    Answered on August 24, 2016 at 09:32 PM

    You might consider the following setup:

    - Assign calculation values to the candidate fields (Yes = 1 point).

    - Calculate the total values.

    - Set your maximum votes value.

    - Add a single condition.

    Example:

    - Field {tags} can be used in Text fields, so you can use your maximum votes field tag like this.

    Result:

    If you need any further assistance, please let us know.

  • Profile Image
    nystea
    Answered on August 24, 2016 at 09:47 PM

    Thanks - That did it. I didn't know how to add fields in text.

    I have another question on the same form.

    Since the vote is anonymous, I want the Thank You screen to reflect the voter choices. It will let them print the screen if they care.

    I edited the Thank You but I'm getting mixed results and I'm not sure why. The {field} should reflect Yes or No, but it is giving 1 and (-1) for some of them. I zapped the fields, saved and started over, but it is giving me some of the "option" fields. 

    Can you see the error?

    Thanks

  • Profile Image
    ashwin_d
    Answered on August 25, 2016 at 03:15 AM

    Hello nystea,

    I have moved your question to a new thread so that we can address it separately. You will be answered here:  https://www.jotform.com/answers/915376 

    Thank you!