Forum: Ruby on Rails Ajax, validation, flash messages & redirects...

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.
Mr C. (Guest)
on 2006-02-23 17:15
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?

Cheers,

coxy
BigSmoke (Guest)
on 2006-03-29 12:44
(Received via mailing list)
Hi,

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
tested
the page in IE. If you find anything missing, please let me know.

Cheers,

Rowan
This topic is locked and can not be replied to.