rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / code / Atom feed
* and then there's checkboxes....
@ 2010-09-02  0:24 Randy Fischer
  0 siblings, 0 replies; only message in thread
From: Randy Fischer @ 2010-09-02  0:24 UTC (permalink / raw)
  To: rack-devel

Just a note:  I've not been able to find, anywhere, docs on
how to correctly get checkboxes to POST through rack
and sinatra.

A colleague from the PHP world said, hey, you gotta
append '[]' to the name of the elements... like

 <input type="checkbox" name="toppings[]" value="pepperoni"
checked="checked"> pepperoni
 <input type="checkbox" name="toppings[]" value="onions" >onions
 <input type="checkbox" name="toppings[]" value="jalapenos" >anchovies

Without that trailing '[]'  on the name to coerce rack to store it as an array,
you are hosed - when I use "toppings", it's a string, but only the last value

Seems very odd, but heh, I understand the decision.

I thought I'd get the solution out in google land though.  I had no luck
trying to find it last night.

-Randy Fischer

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-09-02  0:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-02  0:24 and then there's checkboxes Randy Fischer

Code repositories for project(s) associated with this inbox:


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).