Wednesday, March 13, 2013

[Rails] Re: radio button not saving selected value

NN Dodhia wrote in post #1101393:
> Hi i have this code:
> <div class ="radio">
> <%= radio_button_tag(:milk_code,"Full.", :checked =>(:milk_code
> =='Full.')) %>
> <%= label_tag(:milk_code1, "Full") %>
>
> <%= radio_button_tag(:milk_code,"Milk.",:checked =>(:milk_code ==
> 'Skim'))%>
> <%= label_tag(:milk_code2, "Skim") %>
>
> <%= radio_button_tag(:milk_code,"Semi-Skim')) %>
> <%= label_tag(:milk_code3, "Semi-Skim") %>
>
> But when i submit my form and check the database the value in milk_code
> is
> not saved, any ideas? Also milk_code and milk_code1,2,3 are boolean.



try
:checked => 'checked'

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate