Forum: Ruby on Rails page.update_html not executed

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.
Eb778b8bb642aa8a82c2b8b63705b6af?d=identicon&s=25 Jean-Etienne (Guest)
on 2006-06-11 14:13
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
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-06-11 20:14
(Received via mailing list)
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
Abb249055208c7af4d35568e422dfd63?d=identicon&s=25 Guest (Guest)
on 2006-06-12 02:48
Or, you're linking to the call with a link_to instead of link_to_remote.
Been there, lost lots of hair.
Eef37c9eac0e5440604c2335449c3c62?d=identicon&s=25 Budi Irawan (Guest)
on 2006-06-12 08:34
(Received via mailing list)
oh..maybe you forgot to include

javascript_include_tag :defaults

in your layout
5e518814b76962fdd1ad0e74dfac5ea7?d=identicon&s=25 Martin Gamsjaeger (Guest)
on 2006-06-12 12:08
(Received via mailing list)
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
Eb778b8bb642aa8a82c2b8b63705b6af?d=identicon&s=25 Jean-Etienne (Guest)
on 2006-06-12 17:14
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
> Martin

That was the problem.

Thank you
Eb778b8bb642aa8a82c2b8b63705b6af?d=identicon&s=25 Jean-Etienne (Guest)
on 2006-06-14 10:33
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."
This topic is locked and can not be replied to.