I''m trying to use RJS to construct javascript for an :onDrop callback.
Here''s the code. Fun stuff is the RJS after the :onDrop.
<%= drop_receiving_element :dropAccept, :accept =>
''dragclass'' ,
:onDrop => update_page {|page|page.alert ''no
postback''} %>
This results in the following javascript which throws a syntax error.
//<![CDATA[
Droppables.add("dropAccept", {accept:''dragclass'',
onDrop:try {
alert("no postback");
} catch (e) { alert(''RJS error:\n\n'' + e.toString());
alert(''alert(\"no
postback\");''); throw e }})
//]]>
Anyone have any ideas why?
Many thanks in advance
Andy
Ps. Pretty sure the problem is RJS, since a vanilla JS callback like
below...works fine.
:onDrop => "function(drag, drop){ alert(''you droped ''
+ drag.id + '' on ''
+ drop.id) }"
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---