Hi, when doing: render :update do |page| page.replace_html ''suggested_contractors'', :partial => ''contractors'' page.visual_effect :highlight, ''suggested_contractors'' end I got js as output, it is not executed, return html *contains*: try { Element.update("suggested_contractors", " \n 12345678910\n \n "); new Effect.Highlight("suggested_contractors",{}); } catch (e) { alert(''RJS error:\n\n'' + e.toString()); alert(''Element.update(\"suggested_contractors\", \" \n 12345678910\n \n \");\nnew Effect.Highlight(\"suggested_contractors\",{});''); throw e } Any idea? Thank you, Jean-Etienne www.novAgora.hu -- Posted via http://www.ruby-forum.com/.
I''ll bet the content-type isn''t getting set correctly. Are you setting it explicity in a filter somewhere, accidentally overriding the correct value? -- -- Tom Mornini On Jun 11, 2006, at 5:13 AM, Jean-Etienne wrote:> Hi, > > when doing: > render :update do |page| > page.replace_html ''suggested_contractors'', :partial => > ''contractors'' > page.visual_effect :highlight, ''suggested_contractors'' > end > > > I got js as output, it is not executed, return html *contains*: > try { Element.update("suggested_contractors", " > \n 12345678910\n > \n > "); new Effect.Highlight("suggested_contractors",{}); } catch (e) { > alert(''RJS error:\n\n'' + e.toString()); > alert(''Element.update(\"suggested_contractors\", \" > \n 12345678910\n > \n > \");\nnew Effect.Highlight(\"suggested_contractors\",{});''); throw e } > > Any idea? > > Thank you, > Jean-Etienne www.novAgora.hu > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Or, you''re linking to the call with a link_to instead of link_to_remote. Been there, lost lots of hair. -- Posted via http://www.ruby-forum.com/.
oh..maybe you forgot to include javascript_include_tag :defaults in your layout On 6/11/06, Jean-Etienne <etienne.durand@woa.hu> wrote:> > Hi, > > when doing: > render :update do |page| > page.replace_html ''suggested_contractors'', :partial => > ''contractors'' > page.visual_effect :highlight, ''suggested_contractors'' > end > > > I got js as output, it is not executed, return html *contains*: > try { Element.update("suggested_contractors", " > \n 12345678910\n > \n > "); new Effect.Highlight("suggested_contractors",{}); } catch (e) { > alert(''RJS error:\n\n'' + e.toString()); > alert(''Element.update(\"suggested_contractors\", \" > \n 12345678910\n > \n > \");\nnew Effect.Highlight(\"suggested_contractors\",{});''); throw e } > > Any idea? > > Thank you, > Jean-Etienne www.novAgora.hu > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060612/52e32020/attachment.html
Be sure that you don''t specify an update action twice, i.e. in an rjs template and a link_to_remote. If you have a link_to_remote :update => "mydiv" , AND you have page.update_html "mydiv" .. in an rjs file ... then this will happen! I hope I recall that correctly, but go looking for such scenarios ,,, cheers Martin On 6/12/06, Budi Irawan <manteez8@gmail.com> wrote:> oh..maybe you forgot to include > > javascript_include_tag :defaults > > in your layout > > > On 6/11/06, Jean-Etienne <etienne.durand@woa.hu> wrote: > > Hi, > > > > when doing: > > render :update do |page| > > page.replace_html ''suggested_contractors'', :partial => > > ''contractors'' > > page.visual_effect :highlight, ''suggested_contractors'' > > end > > > > > > I got js as output, it is not executed, return html *contains*: > > try { Element.update("suggested_contractors", " > > \n 12345678910\n > > \n > > "); new Effect.Highlight("suggested_contractors",{}); } catch (e) { > > alert(''RJS error:\n\n'' + e.toString()); > > alert(''Element.update(\"suggested_contractors\", \" > > \n 12345678910\n > > \n > > \");\nnew > Effect.Highlight(\"suggested_contractors\",{});''); throw e > } > > > > Any idea? > > > > Thank you, > > Jean-Etienne www.novAgora.hu > > > > -- > > Posted via http://www.ruby-forum.com/. > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Martin Gamsjaeger wrote:> Be sure that you don''t specify an update action twice, i.e. in an rjs > template and a link_to_remote. If you have a link_to_remote :update => > "mydiv" , AND you have page.update_html "mydiv" .. in an rjs file ... > then this will happen! I hope I recall that correctly, but go looking > for such scenarios ,,, > > cheers > MartinThat was the problem. Thank you -- Posted via http://www.ruby-forum.com/.
Quote from RJS Templates for Rails: "Don''t Use the :update Option with RJS Calls Never use the :update option when making remote calls to actions that render RJS templates. The :update option instructs Rails to generate an Ajax.Updater Prototype object instead of an Ajax.Request object. The Ajax.Updater updates a single DOM element with the contents of the HTML response. RJS templates return JavaScript to the browser, which must be evaluated to produce the desired effects." -- Posted via http://www.ruby-forum.com/.