Submit() a remote_form - using remote link_to?

Hello,

I am trying to submit a remote form without having to use the standard
submit_form button.

This is the call from my form:

<% form_remote_tag :html => {:name => ‘myform’}, :url => {:action =>
:update_doc, :id => @doc} do -%>

and this is the link that i am using to submit the form:

<%= link_to_function ‘Save’, “myform.submit()” %>

The call to update_doc renders a rjs template. I think this should work

  • but i keep getting a popup asking me to save a file - which contains
    the follwing:

try {
new Effect.Highlight(“myform”,{});
} catch (e) { alert(‘RJS error:\n\n’ + e.toString()); alert(‘new
Effect.Highlight(“myform”,{});’); throw e }

What am i doing wrong - i figure it has something to do with the ajax
call to submit the form - which itself performs an ajax call to
update_doc… how can i get around this???

<%= link_to_function ‘Save’, “myform.submit()” %>

What am i doing wrong - i figure it has something to do with the ajax
call to submit the form - which itself performs an ajax call to
update_doc… how can i get around this???

The problem can’t be the two ajax calls, because i can change the link
to the following:

link_to ‘Save’, “javascript:myform.submit()” %>

and it still fails and comes up with the save file prompt as before…