Checkbox lists
Posted: 01 July 2007 10:18 PM   [ Ignore ]
Member
RankRankRank
Total Posts:  141
Joined  2007-03-12

Is there a way of implementing something like this into Freeform? -

http://c82.net/article.php?ID=25

It beats the pants off multi select lists!

 Signature 

Steven Hambleton | Follow me on Twitter!


ExpressionEngine Development for Web & Graphic Design Agencies

Profile
 
 
Posted: 02 July 2007 01:35 AM   [ Ignore ]   [ # 1 ]
Member
Avatar
RankRankRank
Total Posts:  292
Joined  2005-07-09

Interesting idea, have you actually tried that? I mean, it makes use of standard checkboxes (and a bit of CSS), and Freeform supports that just fine. If it does not work, feel free to make the necessary feature request.

 Signature 

Ingmar Greil

Profile
 
 
Posted: 02 July 2007 01:53 AM   [ Ignore ]   [ # 2 ]
Member
RankRankRank
Total Posts:  141
Joined  2007-03-12

I haven’t tried it as I wasn’t sure if Freeform could handle multiple checkboxes and I also wasn’t sure how to write out the code.

There is an example for selects using [] but nothing about checkboxes!

 Signature 

Steven Hambleton | Follow me on Twitter!


ExpressionEngine Development for Web & Graphic Design Agencies

Profile
 
 
Posted: 02 July 2007 02:03 AM   [ Ignore ]   [ # 3 ]
Member
Avatar
RankRankRank
Total Posts:  292
Joined  2005-07-09

Hm, I think I’ve used checkboxes with FreeForm before. Let me check.

 Signature 

Ingmar Greil

Profile
 
 
Posted: 02 July 2007 02:43 AM   [ Ignore ]   [ # 4 ]
Member
Avatar
RankRankRank
Total Posts:  292
Joined  2005-07-09

Yes, it works. Quite straightfoward, really:

{exp:freeform:form form_name="test" template="default_template"}

<p>
Foo:<input type="checkbox" name="foo" /><br />
Bar:<input type="checkbox" name="bar" /><br />
</
p>

<
input type="submit" name="submit" value="submit" />

{/exp:freeform:form} 

Will result in an empty value when unchecked, “on” when checked.

 Signature 

Ingmar Greil

Profile
 
 
Posted: 02 July 2007 03:38 AM   [ Ignore ]   [ # 5 ]
Member
RankRankRank
Total Posts:  141
Joined  2007-03-12

Damn, it’s funny how these things seem so obvious when they are spelled out!!

 Signature 

Steven Hambleton | Follow me on Twitter!


ExpressionEngine Development for Web & Graphic Design Agencies

Profile
 
 
Posted: 02 July 2007 03:47 AM   [ Ignore ]   [ # 6 ]
Member
Avatar
RankRankRank
Total Posts:  292
Joined  2005-07-09

Well, the docs are still somewhat lacking in that regard, I grant you that. Anyway, let us know how it goes, this sounds exciting.

 Signature 

Ingmar Greil

Profile
 
 
Posted: 02 July 2007 06:05 AM   [ Ignore ]   [ # 7 ]
Member
RankRankRank
Total Posts:  141
Joined  2007-03-12

I will do!

 Signature 

Steven Hambleton | Follow me on Twitter!


ExpressionEngine Development for Web & Graphic Design Agencies

Profile
 
 
Posted: 26 September 2007 06:45 AM   [ Ignore ]   [ # 8 ]
Newbie
Rank
Total Posts:  7
Joined  2007-09-26

How about submitting multiple values to the same field via a checkbox list, i.e. all checkboxes have the same name:

<label for=“interests”>What are you interested in:</label>
  Football: <input type=“checkbox” name=“interests” value=“Football” />
  Movies: <input type=“checkbox” name=“interests” value=“Movies” />
  Music: <input type=“checkbox” name=“interests” value=“Music” />


If all are checked only the last value is entered (Music)

Profile
 
 
Posted: 17 October 2007 09:23 AM   [ Ignore ]   [ # 9 ]
Member
Avatar
RankRankRank
Total Posts:  153
Joined  2006-09-11

What about checkboxes that all go to the same field? Ingmar, your example show two different names - what if you want to store more than one value in a field? Is that possible?

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 17 October 2007 09:56 AM   [ Ignore ]   [ # 10 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1042
Joined  2004-03-30

If you want all checkbox values to be captured, turn the fields into an array name=“interests[]”. Freeform will know what to do.

mk

 Signature 
Profile
 
 
Posted: 17 October 2007 10:41 AM   [ Ignore ]   [ # 11 ]
Member
Avatar
RankRankRank
Total Posts:  153
Joined  2006-09-11

That’s what I thought, thanks for confirming.

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 16 July 2008 02:16 PM   [ Ignore ]   [ # 12 ]
Jr. Member
RankRank
Total Posts:  39
Joined  2007-03-01

Is there any way to display all the values of a checkbox array, comma separated, or some other separator?

Thanks!

Profile
 
 
Posted: 16 July 2008 02:38 PM   [ Ignore ]   [ # 13 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  10254
Joined  2006-10-18
AJP - 16 July 2008 02:16 PM

Is there any way to display all the values of a checkbox array, comma separated, or some other separator?

If you’re referring to a notification template, it seems to create a linebreak by default.
As for listing on the front end… there doesn’t seem to be a way to create a seperation. smile

I’ll add this as a feature request though wink

 Signature 
Profile
 
 
Posted: 16 July 2008 02:43 PM   [ Ignore ]   [ # 14 ]
Member
Avatar
RankRankRank
Total Posts:  153
Joined  2006-09-11

I just posted about this in another thread here somewhere… and my post was referring to the notification template. Not very useful “notification” when a number of things are all strung together with only spaces. I’m not seeing any linebreaks on the notification template as it stands now - the contents of the field are one long string. Do the line breaks only work when you’re using the {all_custom_fields} tag? I’m breaking out my notification template into individual fields with some HTML formatting.

I may look at doing a hack of some kind if there isn’t an available hook. Thanks.

ADD: Maybe the “freeform_module_insert_begin” hook could be used to take fields with a certain type(?) or short name suffix (?) and loop through, adding a pipe or a comma or something?

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
@masuga | @masugadesign | @devot_ee

Profile
 
 
   
 
 
‹‹ Dropdown Fields      Getting started docs? ››