I have an app that needs to collect data on gender, so I have:
<span id = "female">Male:
<%= radio_button_tag( :gender, :male,
:checked => @user.gender.to_s == ''Male'' ? true : false,
:options => {:onclick => func2} )%>
</span>
<span id = "male">Female:
<%= radio_button_tag( :gender, :female,
:checked => @user.gender.to_s == ''Female'' ? true : false,
:options => {:onclick => func1} )%>
</span>
I have some remote_function calling stuff happening in the background,
everything works great it terms of saving the information, the issue it
is not showing the corect selected radio button for what is actually
saved by the user. For example, if the user selects ''Male'',
the app
shows ''Female'' as selected. It ''Female'' is
slected it is correct but
only because it is the last button rendered. What it is doiing is
setting both buttons checked value to ''checked'', which it
should not be
doing. I have tried several different way to try and get the correct
radio button to display as checked, such as:
<%= radio_button_tag( :gender, :male,
:checked => @user.gender.to_s == ''Male'' ?
''checked'' : '''',
:options => {:onclick => func1} )%>
This didn''t work either. Anyone know what I am doing wrong. Thanks for
any and all help?
-S
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---