11175
(-- --)
September 20, 2008, 8:41pm
1
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
11175
(-- --)
September 20, 2008, 8:56pm
2
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
Con
(Con)
September 20, 2008, 10:09pm
3
Hi, did you include the following line of code in your head tag:
<%= javascript_include_tag :defaults %>
-Conrad
dabukun
(dabukun@gmail.com)
September 30, 2008, 11:42pm
4
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