All, Do we have access to all of the controller variables in RJS so that we can make decisions within that template as they relate to errors that may have occurred on a form_to_remote call? I have a form_to_remote call that I want to either update a DIV on my page (success) or redisplay the entry form with error messages (some error). I''m pretty sure I can set up two RJS files, one for each case. But what about having one RJS template that is capable of deciding which set of Javascript to execute - can that be done? I don''t think so, but I thought I would ask. Thanks, Wes -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Got this to work but it feels hokey. My controller action renders to an RJS action, like so: unless XYZ.is_valid_email_address?(proof_email) flash[:error] = ''The email address that you entered was not valid'' return render :action => ''proof_failed'' end Then proof_failed.rjs does: page.hide(''proof_status'') page.redirect_to :action => ''proof_form'' The hide is so that the Javascript isn''t rendered in the target ''div'' specified in the form_to_remote call. Then the redirect just sends me back to the entry form which displays my error. A bit roundabout. I''m thinking about a mixed - mode thing where you could use the traditional return method to handle errors and only respond to the AJAX query upon success. But that would leave a bunch of AJAX requests hanging which wouldn''t be good. Hmmm.... Hope this helps someone. Wes -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---