Forum: Ruby on Rails Trigger ajax form submission with drop_receiving_element

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.
Maxime G. (Guest)
on 2006-04-27 19:40
Hello everyone!

I have a little problem with ruby on rails and ajax.

I have 2 sort of droppable items, 2 drop_receiving_element areas working
fine; but instead of updating a div, I would like to have a form
submitted with an ajax call. got it? (not so easy to explain)

My solution was to add a complete action submitting the form like this:

<%= drop_receiving_element "list",
      :url => { :action => "add" },
      :accept => "categories",
      :loading => "'indicator')",
      :complete => "new Ajax.Updater('list', '/review/refresh',
{asynchronous:true, evalScripts:true,

the action 'add' add my element to the list, my 'listform' form is
refreshed by submitting the form through the '/review/refresh' action.

it works well like this but, this make 2 ajax calls ('add' and
'/review/refresh') and the indicator disappear at the end of the first
action, not the second action.

How to do with one ajax call / in a cleaner way?

In my program, the user 'build' a custom form using drag-and-drop.
If the user begins to fill the form and after add an element, if I don't
save the content of the form, the form is resetted.

If you didn't catch what I mean, don't hesitate to ask me more

Thanks for your help,
This topic is locked and can not be replied to.