N.Li
2010-May-19 15:28 UTC
Cannot have both select and radio_button together on the same form
Hello, I''m new to Ruby on Rails.
I am creating a form for searching purpose:
<% form_for :src_cond,
:url => {:action =>''search''} do |p| %>
<%= p.radio_button("bd", "1") %> a
<%= p.radio_button("bd", "2") %> b
<%= p.select :bd2, %w[1 2 3 4],{},{:index=>nil} %>
<%= p.submit "Search" %>
<% end %>
When I click "Search", the browser shows:
"We''re sorry, but something went wrong. We''ve been
notified about
this issue and we''ll take a look at it shortly."
When I check the log, it says:
Status: 500 Internal Server Error
expected Array (got Hash) for param `src_cond''
I''ve put some "puts" statements in the controller, which
indicates the
controller is not called at all.
If I have only radio_button or select in the form, the controller will
be called as expected.
I wonder how I may have both combo box and radio group at the same
time.
Many thanks!!
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Sharagoz
2010-May-19 18:07 UTC
Re: Cannot have both select and radio_button together on the same form
What are you trying to achieve with {:index=>nil} on the select
helper?
<%= p.select :bd2, %w[1 2 3 4] %> should work
On May 19, 5:28 pm, "N.Li"
<chunnim...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hello, I''m new to Ruby on Rails.
>
> I am creating a form for searching purpose:
>
> <% form_for :src_cond,
> :url => {:action =>''search''} do |p| %>
> <%= p.radio_button("bd", "1") %> a
> <%= p.radio_button("bd", "2") %> b
> <%= p.select :bd2, %w[1 2 3 4],{},{:index=>nil} %>
> <%= p.submit "Search" %>
> <% end %>
>
> When I click "Search", the browser shows:
>
> "We''re sorry, but something went wrong. We''ve been
notified about
> this issue and we''ll take a look at it shortly."
>
> When I check the log, it says:
>
> Status: 500 Internal Server Error
> expected Array (got Hash) for param `src_cond''
>
> I''ve put some "puts" statements in the controller, which
indicates the
> controller is not called at all.
>
> If I have only radio_button or select in the form, the controller will
> be called as expected.
>
> I wonder how I may have both combo box and radio group at the same
> time.
>
> Many thanks!!
>
> --
> You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group
athttp://groups.google.com/group/rubyonrails-talk?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.