Forum: Ruby on Rails [newbie] Question about form_remote_tag

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Kevin Hillabolt (Guest)
on 2006-02-12 20:35
Howdy,

I have a form that is defined with "form_remote_tag(:update =>
"my_status", :url => { :action => :responder, :id => @event.id } )",
that uses a model with call to validates_presence_of.

The problem is, I can't seem to figure out how to update the screen
after an @object.save fails, because of values missing (i.e.
validates_presence_of).

The call back to "my_status", which is a DIV, seems to work just fine:
render_text "Saved okay". I guess I'm just missing the method to show
errors from a controller.

Note: I know in the view, you would have "<%= error_messages_for
'object' %>". This never gets updated in the AJAX style call...


Thanks for any help. :)

--Kevin
Kevin Hillabolt (Guest)
on 2006-02-12 20:38
Nevermind, I figured it out:

Stub in a view file that matched my action (by name), and include <%=
error_messages_for 'event' %>.

This is then rendered back in my render_text call.


Simple enough... :)
This topic is locked and can not be replied to.