rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: Randy Fischer <randy.fischer@gmail.com>
To: rack-devel@googlegroups.com
Subject: and then there's checkboxes....
Date: Wed, 1 Sep 2010 20:24:43 -0400	[thread overview]
Message-ID: <AANLkTi=VNaJVLSbNP42KL+3nYn1ETE4SJ0Pz1P7vYRPU@mail.gmail.com> (raw)

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
checked.

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

                 reply	other threads:[~2010-09-02  0:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://groups.google.com/group/rack-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=VNaJVLSbNP42KL+3nYn1ETE4SJ0Pz1P7vYRPU@mail.gmail.com' \
    --to=rack-devel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).