Ajax, RJS, and Standard Form Errors

Hi all,

I’m trying to take the standard scaffold and add a bit for ajax to it.
I
have a two column page with the list on the left and the right side is
reserved for the create/edit actions. On a successful save my rjs
executes
and updates the list view on the left and returns the right side to a
“home”
page. However, if one of the model validations fail I use rjs ro
redisplay
the edit action on the left, which I’ve had to make a partial for the
rjs.
The problem is that the standard form error messages don’t show up. I
think
they make be getting lost with the rjs since it’s not a redirect back
to
the edit action.

Any ideas on how to solve this will be greatly appreciated.


Thanks,

Sam

On 7/9/06, Sam S. [email protected] wrote:

they make be getting lost with the rjs since it’s not a redirect back to
the edit action.

Any ideas on how to solve this will be greatly appreciated.

You need to send the error_messages_for back to the page. If your using
an
rjs template include something like

page.replace_html “some_div_to_display_errors” error_messages_for(
‘some_object’)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs