RJS and :visual_effect

Hi everyone,

I'm working with rails 2.1.1 and i'm in trouble with the scriptaculous
helper.

I have something like :

<%= link_to_function "Details" do |page|
        page['toto'].visual_effect(:toggle_blind)
  end %>

  <div id="toto">
    Bouh
  </div>

Which generates :

<a onclick="try { $("toto").visualEffect("toggle_blind"); } catch (e) {
alert('RJS error:\n\n' + e.toString());
alert('$(\"toto\").visualEffect(\"toggle_blind\");'); throw e }; return
false;" href="#">Details</a>
<div id="toto"> Bouh </div>

When i click it under firefox, I get the error :

RJS error:

TypeError: Effect[klass] is not a constructor

I get approximatively the same error on safari.

Does anyone see what's the problem ?

Thanks

Olivier

Finally, i made it work but by coding :

My old code :

link_to_function("Show me more", nil, :id => "more_link") do |page|
    page[:details].visual_effect :toggle_blind
    page[:more_link].replace_html "Show me less"
  end

doesnt work.

I think the page
http://api.rubyonrails.com/classes/ActionView/Helpers/JavaScriptHelper.html#M001687
should be modified because it gives a non working example !

cheers

Hi, did you include the following line of code in your head tag:

<%= javascript_include_tag :defaults %>

-Conrad

I'm trying to accomplish the same thing with no luck. So did you just
code the javascript yourself instead of using the helpers?

I second that the documentation seems to be inaccurate...

This syntax worked for me:

<%= link_to_function "Details" do |page|
         page.visual_effect(:toggle_blind, 'toto')
  end %>

<div id="toto">
    Bouh
</div>

- Greg