rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: Silviu Rusu <slivuz@gmail.com>
To: rack-devel@googlegroups.com
Subject: Re: Checkbox selection trouble in request.params
Date: Fri, 15 Jun 2012 20:11:47 +0300	[thread overview]
Message-ID: <FED7BAC8-3737-4C0F-9E2D-372D3E5C23DD@gmail.com> (raw)
In-Reply-To: <af73c019-31a9-44d1-9507-946025b61c1b@u1g2000pbb.googlegroups.com>


correct way to use this:

<input type="checkbox" name="foo[]" value="1"> Item 1
<input type="checkbox" name="foo[]" value="2"> Item 2

note []  after foo


On Jun 15, 2012, at 8:15 PM, Randy M wrote:

> Well, but these HTML checkbox generates that query_string..
> 
> <input type="checkbox" name="foo" value="1"> Item 1
> <input type="checkbox" name="foo" value="2"> Item 2
> 
> at Rack, we cannot use these type form field?
> 
> 
> On 6月16日, 午前12:58, Joshua Ballanco <jball...@gmail.com> wrote:
>> You've only passed one parameter. The first "foo=1" sets the foo parameter to 1. The second "foo=3" re-assigns foo to 3. If you want two parameters to be passed to your app, you need to define two separate parameters.
>> 
>> On Wednesday, June 13, 2012 at 10:55 AM, Randy M wrote:
>>> Hello everyone.
>> 
>>> I'm using rack (1.4.1), but it seems cannot receive
>>> checkbox selection value..
>> 
>>> http://localhost/hello.cgi?foo=1&foo=3
>>> Hello, Rack
>>> {"foo"=>"3"}
>> 
>>> Code below.
>> 
>>> #!ruby
>>> require "rack"
>>> class HelloRack
>>> def call(env)
>>> req = Rack::Request.new(env)
>>> return [200, {"Content-Type" => "text/plain"},
>>> "Hello, Rack\n" + req.params.inspect ]
>>> end
>>> end
>>> Rack::Handler::CGI.run HelloRack.new
>> 
>>> Could anyone tell me idea?

  reply	other threads:[~2012-06-15 17:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-13  7:55 Checkbox selection trouble in request.params Randy M
2012-06-15 15:58 ` Joshua Ballanco
2012-06-15 17:15   ` Randy M
2012-06-15 17:11     ` Silviu Rusu [this message]
2012-06-16  8:13       ` Randy M

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=FED7BAC8-3737-4C0F-9E2D-372D3E5C23DD@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).