We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Solspace freeform checkboxes

Development and Programming

CDI Services's avatar
CDI Services
1 posts
16 years ago
CDI Services's avatar CDI Services

How can I create Checkboxes with Solspaces freeform. I only have text input and textfield options when created a new field. I need it for two reasons

the first:

I want the user to pick what services(checkboxes) they are interesting in:

the second: I need to add a checkbox to a solspace freeform for adding the sender to a mailing list. i know how to specify the mailing list just dont know how to add the checkbox.

KEvin

       
MeanStudios's avatar
MeanStudios
335 posts
16 years ago
MeanStudios's avatar MeanStudios

You can create the check boxes and then for the name attribute for each checkbox use something like “services[]”. This will put all the values of each checkbox into the services variable. Then in freeform create a textfield named services. You can call it in your freeform template. If that doesn’t work, check out example 3 here. He does it using a multiple select box.

       
JenSkim's avatar
JenSkim
197 posts
about 16 years ago
JenSkim's avatar JenSkim

I don’t this solution works. when you code for radio buttons, you can use the value parameter to pass information, but same does not work with check box. It also does not work with checkbox name parameter.

       
broseth's avatar
broseth
3 posts
15 years ago
broseth's avatar broseth

I just gave this a try and it worked for me. In EE 1.6.8, used the following:

{exp:freeform:form form_name="volunteer_form" required="name|email"}
     <input type="checkbox" name="volunteer_interests[]" value="advocate"/>
     <input type="checkbox" name="volunteer_interests[]" value="friend"/>
     <input type="checkbox" name="volunteer_interests[]" value="board_member"/>
     <button type="submit">Sign Up</button> 
{/exp:freeform:form}

With a Freeform text input field named ‘volunteer_interests’, checked values are added as a space-delimited string. Unchecked values are not added.

If indeed it fails for some reason, you could always store the values in a hidden field via javascript before submitting the form.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.