PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

How to pre-populate checkboxes

  1. I have a simple form that pops up in a FancyBox iFrame to allow users to sign up for one (or both) of the two newsletters on offer. Here's the page that gets iFramed. The pop-up is triggered by clicking the yellow Post-it in the sidebar here.

    Now the emails that go out to subcribers have links to subscribe, unsubscribe, and to subscribe to the list *other* than the one they're on (i.e. you get a mail from List 1 but it has a link to subscribe to List 2 also).

    I'm using links with query strings in the emails so someone who clicks on a link to subscribe to List 1 will get a form with their name and email filled in, and the List 1 checkbox checked.

    The name and email are populating as expected (http://www.chiefrabbi.co.za/sign-up/?username=Bob&emailaddress=bob@bob.com), but I don't know how to get the checkbox pre-checked. The parameter I'm using for now for the first checkbox is 'connecting'. How do I specify this in the query string? &connecting=checked, &connecting=true, &connecting=yes all do nothing.

    What's the correct syntax?

    Posted 9 years ago on Tuesday June 8, 2010 | Permalink
  2. You populate it the same way. You would pass connecting= in your query string and pass the full value of that checkbox. Until we implement separate label/value options for drop down/checkboxes and radio buttons you would have to pass the full label name for the checkbox you want to check.

    For example:

    http://www.chiefrabbi.co.za/sign-up/?username=Bob&emailaddress=bob@bob.com&connecting=Connecting%20with%20the%20Chief%20Rabbi,%20sent%20out%20approximately%2010%20times%20a%20year,%20focuses%20on%20topical%20issues%20from%20a%20Torah%20perspective

    Please note that the %20 is escaping the blank space in the string.

    Posted 9 years ago on Tuesday June 8, 2010 | Permalink
  3. Aha, thanks for that! I've spent the past 2 hours messing with different Boolean operators and trying to work out what I was doing wrong.

    I've used the lengthy description as a bit of a CSS workaround/hack, but the actual label is hidden, so I can use that.

    Thanks again, and for the speedy response!

    Posted 9 years ago on Tuesday June 8, 2010 | Permalink
  4. I'm not sure I understand.

    I've a Checkbox group called languages. The Choices are English, Spanish, and Other. When using the "gform_post_submission" hook, I read the values from $entry[16.1], $entry[16.2], and $entry[16.3]. This all works great. Users can select One, Two, or all Three Choices.

    Now though, when attempting to pre-populate through PHP, I've run into a wall where the "Parameter Name" (in the from UI) only takes one value... It's it just a hard limitation that only One choice can be pre-populated? Or am I missing something else entirely?

    Posted 9 years ago on Tuesday January 11, 2011 | Permalink
  5. I think I'm supposed to pass a comma separated list of values to the single parameter... it isn't working yet, but I'm sure that's what I'm supposed to do here.

    Posted 9 years ago on Tuesday January 11, 2011 | Permalink
  6. Success! Now to only figure out how to set the Tag and Category parameters!

    Posted 9 years ago on Tuesday January 11, 2011 | Permalink

This topic has been resolved and has been closed to new replies.