Forum: Ruby on Rails simple radio_button

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Chika (Guest)
on 2007-01-30 20:08
Hello, I'm having a problem with radio_button, I don't know what I'm
doing wrong so please help me checking.
I need the "user" to select the kind of report to load, The options are
given with radio_buttons like this:

<td>MES ACTUAL  <%= radio_button 'tipo','mes', {:checked => 'true'}
%></td>
<td>ANUAL    <%= radio_button 'tipo','anual', {:checked => 'true'}
%></td>
<td>ACUMULADO TOTAL  <%= radio_button 'tipo','acumulado',{:checked =>
1}%></td>

but they get loaded unchecked, if you check them, then you cant uncheck
them, and that is not what I want.
I just need the to work like simple radio_button that you can check or
unchek, and having to choose only one.

What is wrong?
Stephen B. (Guest)
on 2007-01-30 20:17
(Received via mailing list)
> What is wrong?
I'm not sure that it's radio buttons you need for this.  Try
'check_box' instead.

Steve
Chika (Guest)
on 2007-01-30 20:26
Never mind , I make it work,I change it to this:

<td>MES ACTUAL   <%= radio_button ('reporte','tipo', 'mes' ) %></td>
<td>ANUAL        <%= radio_button ('reporte','tipo', 'anual') %></td>
<td>ACUMULADO TOTAL <%= radio_button
('reporte','tipo','acumulado',:checked=>true)%></td>


It seems that it needs to have the 2 first arguments name the same way
to work as I needed.

Thanks anyway
This topic is locked and can not be replied to.