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

  • nystea
    Asked on August 24, 2016 at 6: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!

  • Mike
    Replied on August 24, 2016 at 9:32 PM

    You might consider the following setup:

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

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

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

    - Calculate the total values.

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

    - Set your maximum votes value.

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

    - Add a single condition.

    Example:

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

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

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

    Result:

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

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

  • nystea
    Replied on August 24, 2016 at 9: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

  • Ashwin JotForm Support
    Replied on August 25, 2016 at 3: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!