default selections on required checkboxes

  • Profile Image
    Asked on May 30, 2011 at 02:05 PM

    (This seems to have gone up twice, but that was not my intention, sorry, feel free to delete one.)


    Hi there.  I'm using some required checkbox fields, and it would be nice to have all boxes default selected for some questions.  Unfortunately, all I see is the option to have no boxes for a question pre-selected, or just ONE box pre-selected.  Causing the user to UNselect what they do not want, instead of only having the ability to select what they DO want.


    (I could go into why I want this, but I don't think it's relevant.  Trust me, there would be some useful applications.)


    Is there a way to pre-select multiple checkboxes or all, not just one?

  • Profile Image
    Answered on May 30, 2011 at 04:03 PM

    Hi Robin,

    Yes this is possible by utilizing query strings in the form's url. Query strings act like parameters to a form. They are appended in the url of any webpage you want to apply the parameters to.

    In html forms, they can be used to set values to form inputs such as textboxes, checkboxes, radio etc.

    Take a look at this sample form for a demo.

    As you can see I have appended a few query strings in the url which is ?options[]=Red,Orange,Violet

    options[] is the input name property of my form's checkbox field. You can look it up in the form's source code by finding codes similar to this:

    <input id="input_1_2" class="form-checkbox" type="checkbox" value="Yellow" name="q1_options[]">

    The values are then inserted after the equal sign ( = ) separated by a comma ( , )

    If you embedded the form using iframe codes, you just need to append the query strings in the url of the iframed document

    <iframe allowtransparency="true" src="//[]=Red,Orange,Violet" frameborder="0" style="width:100%; height:465px; border:none;" scrolling="no">

    Let me know if you need clarifications regarding this solution.


  • Profile Image
    Answered on May 30, 2011 at 04:21 PM

    If you're using Source embed codes, you can just add this property to the tags of each of the input that you want selected:


    so it becomes

    <input id="input_1_2" class="form-checkbox" type="checkbox" checked="checked" value="Yellow" name="q1_options[]">