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.
on 2013-03-13 12:50
on 2013-03-13 13:38
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'
on 2013-03-14 22:05
On 13 March 2013 11:48, NN Dodhia <aca10nnd@sheffield.ac.uk> wrote: > <%= 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. Have a look at the Rails Guide on Debugging which will show you techniques that you can use to debug your code. The first thing to do (which is the case when debugging any code) is to find which bit is failing. You can look in the log to check that the correct data is being posted and then use the debugging techniques in the controller to see why it is not being saved. Colin
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.