Remote_form_for validation


#1

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


#2

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


#3

Thank you!