My drop down gets reset to the first value when the form gets returned with errors. here is my code: <%= f.select :card_type, [ [''Choose a Payment Type'', nil], [''Visa'', ''Visa''], [''MasterCard'', ''master''], [''American Express'', ''American Express'']] %> For example, say the user selects "Visa" and doesn''t fill out the rest of the form correctly. The user submits the form and errors are shown. For some reason this drop down does not keep the "Visa" value and goes back to the "Choose a Payment Type". How can i keep the value in the drop down after errors are shown? -- 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 -~----------~----~----~----~------~----~------~--~---
have you tried logging the value of @my_obj.card_type to see what it returns? Mike On 3/3/08, Jimmy Palmer <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > My drop down gets reset to the first value when the form gets returned > with errors. > > here is my code: > > <%= f.select :card_type, [ > [''Choose a Payment Type'', nil], > [''Visa'', ''Visa''], > [''MasterCard'', ''master''], > [''American Express'', ''American Express'']] %> > > For example, say the user selects "Visa" and doesn''t fill out the rest > of the form correctly. The user submits the form and errors are shown. > For some reason this drop down does not keep the "Visa" value and goes > back to the "Choose a Payment Type". > > How can i keep the value in the drop down after errors are shown? > -- > 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 -~----------~----~----~----~------~----~------~--~---
Mike Garey wrote:> have you tried logging the value of @my_obj.card_type to see what it > returns? > > Mikethat value gets sent over the wire correctly, but it doesn''t come back up if the form had errors. -- 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 -~----------~----~----~----~------~----~------~--~---
post your code On 3/3/08, Jimmy Palmer <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Mike Garey wrote: > > have you tried logging the value of @my_obj.card_type to see what it > > returns? > > > > Mike > > > that value gets sent over the wire correctly, but it doesn''t come back > up if the form had errors. > > -- > > 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 -~----------~----~----~----~------~----~------~--~---