Radio_button_tag


#1

I have an app that needs to collect data on gender, so I have:

Male:
<%= radio_button_tag( :gender, :male,
:checked => @user.gender.to_s == ‘Male’ ? true : false,
:options => {:onclick => func2} )%>

Female:
<%= radio_button_tag( :gender, :female,
:checked => @user.gender.to_s == ‘Female’ ? true : false,
:options => {:onclick => func1} )%>

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