Good morning, I have a form with 5 fields. When I click "Save", 3 of the 5 fields save to the database and the other 2 are saved as NULL. The form code is attached. The 2 fields that will not save are using collection_select. On the web page I can click on each of the drop down boxes and select an item, but for some reason they will not save to the database fields. Thank you, Frank Attachments: http://www.ruby-forum.com/attachment/3381/form.txt -- 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 -~----------~----~----~----~------~----~------~--~---
On 3 Mar 2009, at 16:47, Frank Kany wrote:> > Good morning, > > I have a form with 5 fields. When I click "Save", 3 of the 5 fields > save to the database and the other 2 are saved as NULL. > > The form code is attached. > > The 2 fields that will not save are using collection_select. On the > web > page I can click on each of the drop down boxes and select an item, > but > for some reason they will not save to the database fields.Hard to tell without the matching controller code but I''m guessing that your controller code is expecting the collection_select parameters to be in the same place as other ones (ie inside params[:time_subtype], assuming that''s the name of your model) but it won''t be because you''re using a raw collection_select rather than form.collection_select. Fred> > > Thank you, > > Frank > > Attachments: > http://www.ruby-forum.com/attachment/3381/form.txt > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Frank Kany wrote:> Good morning, > > I have a form with 5 fields. When I click "Save", 3 of the 5 fields > save to the database and the other 2 are saved as NULL. > > The form code is attached. > > The 2 fields that will not save are using collection_select. On the web > page I can click on each of the drop down boxes and select an item, but > for some reason they will not save to the database fields. > > Thank you, > > FrankI think that :name, :comment, :active_flag values are stored in the params[:time_subtype] array because text_field, text_area and check_box are called on the form object. However your collection_select calls do not refer to the form, so they''re not stored in params[:time_subtype], and if you update your object with params[:time_subtype] as parameter the :entity_id, :time_type_id are not found. With your code these values are accessible in params[:facility][:entity_id] and parms[:time_type][:id]. What attributes do these two form elements refer to ? -- 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 3 Mar 2009, at 16:47, Frank Kany wrote: > >> page I can click on each of the drop down boxes and select an item, >> but >> for some reason they will not save to the database fields. > > Hard to tell without the matching controller code but I''m guessing > that your controller code is expecting the collection_select > parameters to be in the same place as other ones (ie inside > params[:time_subtype], assuming that''s the name of your model) but it > won''t be because you''re using a raw collection_select rather than > form.collection_select. > > FredAhhhh....the form.collection_select pointed me in the right direction. I''ve attached my changes. Thank you Fred & Sébastien for your replys. Attachments: http://www.ruby-forum.com/attachment/3382/form.txt -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---