Radio buttons on edit/update form

Radio buttons in an edit/update form do not display the underlying
data (all radio buttons are displayed unchecked) although any changes
made through these contols are updated.

        <%= f.radio_button(:sex, 'female', :checked =>

“unchecked”) %>
<%= f.radio_button(:sex, ‘male’, :checked => “unchecked”)
%>

In this case the column type is a string, however the same problem
holds for boolean and integer column types. Anyway, I am missing
something integal in the process, but clueless as to what it is.

Feedback will be much appreciated.

Thanks, Bill

zambezi wrote:

Radio buttons in an edit/update form do not display the underlying
data (all radio buttons are displayed unchecked) although any changes
made through these contols are updated.

        <%= f.radio_button(:sex, 'female', :checked =>

“unchecked”) %>
<%= f.radio_button(:sex, ‘male’, :checked => “unchecked”)
%>

In this case the column type is a string, however the same problem
holds for boolean and integer column types. Anyway, I am missing
something integal in the process, but clueless as to what it is.

Don’t set :checked – let Rails determine state from the object.

Feedback will be much appreciated.

Thanks, Bill

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Marnen,

You are correct. In my copy and paste haste, I had forgot to make the
changes.

Thank you much.

Bill

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs