Hi all, Country select should be simple in rails, but my code below: <%= country_select(:user, :country, {:selected=>''DK'',:include_blank=>true}) %> is obviously a little too simple :) I get my drop-down list of countries, but the value I select on the page doesn''t get saved. I get no errors, but the value in my sql database isn''t updated. Can someone please tell me how to save the selected country when I press ''submit''. Thanks. -- 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 -~----------~----~----~----~------~----~------~--~---
Jan Ask wrote:> Hi all, > > Country select should be simple in rails, but my code below: > > <%= country_select(:user, :country, > {:selected=>''DK'',:include_blank=>true}) %> > > is obviously a little too simple :) > > I get my drop-down list of countries, but the value I select on the page > doesn''t get saved. I get no errors, but the value in my sql database > isn''t updated. Can someone please tell me how to save the selected > country when I press ''submit''. > > Thanks.Just off the top of my head, is your select helper inside a form? -- 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 -~----------~----~----~----~------~----~------~--~---
Shandy Nantz wrote:> Jan Ask wrote: >> Hi all, >> >> Country select should be simple in rails, but my code below: >> >> <%= country_select(:user, :country, >> {:selected=>''DK'',:include_blank=>true}) %> >> >> is obviously a little too simple :) >> >> I get my drop-down list of countries, but the value I select on the page >> doesn''t get saved. I get no errors, but the value in my sql database >> isn''t updated. Can someone please tell me how to save the selected >> country when I press ''submit''. >> >> Thanks. > > Just off the top of my head, is your select helper inside a form?Thanks for the reply. Yep. The complete bit of code looks like this: <div title="<%= title_helper %>" class="form"> <%= head_helper :error => true %> <%= start_form_tag_helper %> <b> Select country: </b><br> <%= country_select(:user, :country, {:selected=>''DK'',:include_blank=>true}) %> <%= render_partial ''edit'', :user => @user, :submit => true %> <%= end_form_tag %> </br> -- 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 -~----------~----~----~----~------~----~------~--~---