Forum: Ruby on Rails Multiple calls from drop_receiving_element :complete

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Kent (Guest)
on 2006-03-30 01:30

Firstly I am very new to Ruby on Rails but think its fantastic! :o)

I am trying to figure out how I can call multiple functions from the
drop_receiving_element :complete. I have the following code in my
index.rhtml and it works fine. It calls the javascript function
"additem" that is on the page.

<%= drop_receiving_element "dcwindow",
		      :update => "items", :url => { :action => "add" },
		      :accept => "products", :hoverclass => "cart-active",
		      :loading => "'indicator')",
		      :complete => "additem(element.alt,"

But what I would like to do is call 2 functions.

		      :complete => "Element.hide('indicator')",
		      :complete => "additem(element.alt,"

One way that I thought would be possible would be to call do something
like this
  :complete => { :action => "myfunction" }

Then from the server it could somehow call a javascript function that
exists on the webpage

def myfunction
 call_javascript_on_webpage "additem(element.alt,"
 Then somehow call Element.hide('indicator')

Also how do I get variables into myfunction? (ie element.alt,

Hope someone can help me :)

This topic is locked and can not be replied to.