RJS and :visual_effect

Hi everyone,

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

I have something like :

<%= link_to_function "Details" do |page|
  end %>

  <div id="toto">

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 ?



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"

doesnt work.

I think the page
should be modified because it gives a non working example !


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

<%= javascript_include_tag :defaults %>


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">

- Greg