I have a form which contains the following updater: <input name=''commit'' type=''submit'' value=''Enter'' onClick="new Ajax.Updater(''div_recipients'', ''updtrecipients'', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this.form)} ); return false;"> When I use this form in a ''new'' action, it works as expected. However, When I try it with an ''edit/<id> action, it fails to call updtrecipients, and instead calls edit, which renders the whole page into div_recipients. I have noticed in the logs that params contains :id=>''updtrecipients'' when this happens. Anyone know what''s going on? For now I have just added if request.xhr? updtrecipients and return true end to the top of my edit action, which works, but if anyone has a solution that is less ugly, I''d like to know what it is. Thanks much Ken -- I use the words you taught me. If they don''t mean anything any more, teach me others. Or let me be silent. Samuel Beckett (Clov, Endgame) --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Hello Kenneth, 2007/5/1, Kenneth Dunlap <kd@panix.com>:> onClick="new Ajax.Updater('div_recipients', > 'updtrecipients', > {asynchronous:true, evalScripts:true, parameters:Form.serialize(this.form)} > ); return false;">Your problem is the URL of the Updater. You're telling it to POST relative to the current URL. If you have /contacts/new, you'll get /contacts/updtrecipients, and if you have /contacts/edit/13, you'll get /contacts/edit/updtrecipients. You're much better off using absolute URLs, or using named routes (which give you absolute URLs always). Hope that helps ! -- François Beausoleil http://blog.teksol.info/ http://piston.rubyforge.org/ --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Quoth Fran??ois Beausoleil (francois.beausoleil-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org):> Hello Kenneth, > > 2007/5/1, Kenneth Dunlap <kd-VmQCmMdMyN0AvxtiuMwx3w@public.gmane.org>: > > onClick="new Ajax.Updater(''div_recipients'', > > ''updtrecipients'', > > {asynchronous:true, evalScripts:true, parameters:Form.serialize(this.form)} > > ); return false;"> > > Your problem is the URL of the Updater. You''re telling it to POST > relative to the current URL. > > If you have /contacts/new, you''ll get /contacts/updtrecipients, and if > you have /contacts/edit/13, you''ll get /contacts/edit/updtrecipients. > > You''re much better off using absolute URLs, or using named routes > (which give you absolute URLs always). > > Hope that helps !That seems to have done the trick. Thanks. Ken -- I use the words you taught me. If they don''t mean anything any more, teach me others. Or let me be silent. Samuel Beckett (Clov, Endgame) --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---