How do I pre-fill array parameters?

  • Profile Image
    emersum
    Asked on February 25, 2011 at 02:16 PM

    Hei!

    I'm using a form to update already existing data. I have no problem pre-filling individual fields and name or phone number fields.

    However, in my forms I have a set of checkboxes and I don't know how to pass parameters to the form to pre-check only some of the options as I need. I'm using something like ...&arrayName[]=xxx&arrayName[]=yyy but it doesn't seem to work..

    Thanks!

  • Profile Image
    liyam
    Answered on February 26, 2011 at 12:16 PM

    Hi, do you simply want check boxes to be pre-checked once the form loads? Unfortunately, JotForm only allows to choose one at the moment.

    Sorry updating, I got confused with your question.  Here's what you have to do:

    1. find the checkbox name in the checkbox tag
    2. copy the name after the "_" and before"["
    3. copy the value

    example:

    <input type="checkbox" class="form-checkbox validate[required]"
    id
    ="input_13_0" name="q13_categorieDi[]" value="Impianti elettrici" />

    so once you're able to get the names of each checkbox, include them in the URL, remember to put "?" after the URL to declare that you are submitting parameters, then comes the name followed by "=", then the value.

    If you wish to add more parameters, these are to be separated by "&" sign.  Unfortunately, this will only work with one name for each in a URL parameter, and the checkbox array consists only of one name for one field for it to be called via URL

    example:

    http://www.jotform.com/10555550133?categorieDi=Impianti elettrici

    Another Option if you wish to have numerous checkboxes pre-checked:

    What I could suggest to you is export the source code of the form and place it into your webpage. And simply add the property and value 'checked="checked"' for each checkbox tag that you wish pre-selected.

    Hope this helps

  • Profile Image
    emersum
    Answered on February 27, 2011 at 08:55 AM

    Thanks. I'd seen some implementations use a form where (for fields where multiple choices are poissible), the parameter name is simply repeated in the URL - e.g. ...&choice1[]=XXX&choice1[]=YYY&... would set both XXX and YYY in a field choice1 (if present).

    But thanks anyway, I guess I'd ll'have to use the script source directly as you say.

    Thanks!

  • Profile Image
    liyam
    Answered on February 28, 2011 at 12:42 AM

    I see, I will forward this matter to the development team and see what we can find.

    Alternatively for now, you can create one checkbox form field for every value so that you can submit via URL parameter submission.

  • Profile Image
    JotFormSupport
    Answered on February 28, 2011 at 04:56 AM

    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #3902ee}

    You will need to put commas between items. Please see the example form address below:

     

    http://www.jotform.com/10555550133?categorieDi[]=Altro,Vetro,Giardinaggio,Ventilazione

     

    Liyam, you can give the address of this forum post if similar questions asked. You have explained the issue very well. Your explanation explains how to prepopulate the fields.

  • Profile Image
    emersum
    Answered on February 28, 2011 at 07:05 AM

    Thanks, you guys have an amazing service. :-)

  • Profile Image
    liyam
    Answered on February 28, 2011 at 09:30 AM

    Glad to know that it works for you, emersum.

    JotFormSupport: This is noted.  Thanks