2009/8/29 bgumbiker <[email protected]>: > > Hello, > Does anyone know how to use error_messages_for with remote_form_for? > > Here is my code: > > <%= error_messages_for 'quotation' %> > > <div id="quotation_form"> > <% remote_form_for(Quotation.new, :url => { :action => > "send_quotation" }) do |f| %> > .... > .... > .... > <% end %> > > > The <%= error_messages_for 'quotation' %> is always replaced by empty > space in html as 'quotation' at that time is nil. > > Any idea how to make it work without setting 'quotation' variable in > the controller?
I am a bit of a loss to understand what you are doing here, though this may be my problem rather than yours. As I understand it error_messages_for is displays the errors associated with the given variable. If quotation is nil how can it have errors associated with it? You have not described what you are doing to generate some errors that you would like to display. Presumably this is as a result of submitting the form that is being generated, if so what are you doing to get the invalid object back to the displayed page so its errors can be displayed? Colin --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

