Limit checkbox question answers to three only

  • Profile Image
    Asked on March 08, 2012 at 10:10 AM

    Hi there,

    We are trying to create a survey with multiple questions. We want people to only select 3 responses to questions 2, 5 and 9 however.

    Can you tell me how we go about doing this as the workarounds I've tried haven't worked.


    Sine FM

  • Profile Image
    Answered on March 08, 2012 at 10:36 AM

    Unfortunately we don't have that option on our form builder yet but you can actually implement this using full source code and customize it to a Javascript solution like the one described in this page:

    Hope that helps :)

  • Profile Image
    Answered on March 08, 2012 at 10:36 AM


    We are not able to support this feature now but our developers are working towards making it available soon.

    The only option that you can have is place the source code of your form on your own web page since Jotform does not allow placing javascripts inside the form.

    To place the form on your own web page:

    1. Edit your form
    2. Click Embed Form
    3. An Embed form wizard will appear, select Source

    4. Copy the code on the next slide and paste it on your own web page.

    After copying the form source code on your web page, you can add the script that I found on this URL:

    Kindly follow the steps keenly and you can be able to get fiorm like this;

    Kindly let us know if you were assisted.



  • Profile Image
    Answered on March 08, 2012 at 11:00 AM

    I can get it to work if I'm only asking one question. But if I'm asking multiple questions - where some aren't checkbox questions - I can't get it to work.

    Where exactly does the script need to be placed in the source code for the form to only affect questions 2, 5 and 9?

  • Profile Image
    Answered on March 08, 2012 at 12:04 PM


    Unfortunately, that solution was designed for a single checkbox form. The codes would need to be tweaked in order for it to work on multiple checkboxes.

    I will personally look into it and see what I can do to have it adapt to your form.

  • Profile Image
    Answered on March 08, 2012 at 08:50 PM

    Here is a solution, Sine FM:

    Copy and paste this code in your header tag:

    <script type="text/javascript">

    * Limit number of checked checkboxes script- by JavaScript Kit (
    * This notice must stay intact for usage
    * Visit JavaScript Kit at for this script and 100s more

    function checkboxlimit(checkgroup, limit){
        var checkgroup=checkgroup
        var limit=limit
        for (var i=0; i<checkgroup.length; i++){
            var checkedcount=0
            for (var i=0; i<checkgroup.length; i++)
                checkedcount+=(checkgroup[i].checked)? 1 : 0
            if (checkedcount>limit){
                alert("You can only select a maximum of "+limit+" checkboxes")


    Next, find the checkbox group name that you wish to have the checkbox to have limits. In your form, I found these:

    1. q13_2Which[]
    2. q6_5Which[]
    3. q9_9whichThree[]

    Now that we have identified the three checkbox groupings, insert this code just right after the closing form tag (</form>)

    <script type="text/javascript">

    //Syntax: checkboxlimit(checkbox_reference, limit)
    checkboxlimit(document.forms['form_20665106465957']['q13_2Which[]'], 2)
    checkboxlimit(document.forms['form_20665106465957']['q6_5Which[]'], 3)
    checkboxlimit(document.forms['form_20665106465957']['q9_9whichThree[]'], 3)


    Note: The number in the end is the limit counter for your checkbox group.  Feel free to change it with the number of checkboxes your checkbox group you wish to be limited to.


    Javascript code reference: