Ajax, validation, flash messages & redirects

Hi everyone,

I’m working on an file upload page that uses an ajax progress bar
(http://sean.treadway.info/demo/upload/). I’ve also got validation on
the uploads (must be a certain file size/mime type etc). When uploads
pass validation - all is dandy. But when they fail - I can’t work out
how to redisplay the form with the flash error messages (that normally
appear when not using the ajax progress bar).

I’m new to RoR so apologies if i’ve missed something simple. I guess
this has to do with the form being submitted to a hidden iframe? So how
can I display the error messages to the user - in the normal way (i.e.
the flash messages at the top of the form) - after an upload fails
validation. Ideally i’d do a "redirect_to :action => ‘new’ " (instead of
“render”) when the object is not saved but how do I display the flash
messages and keep the form contents filled in this case?




I hope this reply is not too late to be useful, but I just wrote a text
discussing just this. You can find that text at
http://www.bigsmoke.us/ajax-validation-in-rails. Note that I haven’t
the page in IE. If you find anything missing, please let me know.



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