Forum: Ruby on Rails remote_form_for validation

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.
jko170 (Guest)
on 2007-03-20 03:36
(Received via mailing list)
If I'm using remote_form_for, how would I get the model validations to
render just like on a non-ajax form?
Xavier N. (Guest)
on 2007-03-20 11:52
(Received via mailing list)
On Mar 20, 2007, at 2:36 AM, jko170 wrote:

> If I'm using remote_form_for, how would I get the model validations to
> render just like on a non-ajax form?

This is a possible pattern: In the view you have a DIV for errors,
originally empty, and perhaps factored out to a partial ready for RJS
"reloading".

When the form is submitted there's a RJS response that updates that
DIV if @model.errors.empty? > 0, or else follows your regular
application flow, for example it redirects to a show action with
page.redirect_to.

-- fxn
jko170 (Guest)
on 2007-03-22 15:41
(Received via mailing list)
Thank you!
This topic is locked and can not be replied to.