Forum: Ruby on Rails What's the javascript to submit an AJAX Form?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3203ed0e608d3bfae1e31282e629ffa2?d=identicon&s=25 Peter Fitzgibbons (Guest)
on 2006-02-02 21:33
(Received via mailing list)
HI Everyone,

How do I form the href on an anchor so I can create a link-style submit
for
an ajax form?

In this snippet, the INPUT generated by #submit_tag works OK, but the
anchor
results in the AJAX replacing the whole page?

Can I make the anchor/href submit the AJAX form as well?

Thank you!


I have this (list.rhtml):

    <%= form_remote_tag  :url => {:action=>:ajax_list_option_table},
                        :html => {:name=>'option_list_form'},
                        :update => 'option_table',
                        :complete => "Toggle.display('auto_link_link')";
%>

  <h1>Options</h1>
  <p></p>
  <table border="0">
  <tr>
  <td/>
  <td align="right" cols="2">
  <%= submit_tag "GO" %>
  <a class="button"
href="javascript:document.option_list_form.submit();"
name="go" >GO</a>&nbsp;
  </td>
  </tr>
  </table>

    <%= end_form_tag -%>

<table>
<tbody id="option_list_table">
</tbody>
</table>

--
7b829a0c4495eb471379bcc786307a95?d=identicon&s=25 Matt Secoske (Guest)
on 2006-02-02 22:21
(Received via mailing list)
You are supposed to be able to add a :submit option, which will get the
value of One (and only one as far as I know... I just asked about that
myself) element (by id) in the form.

Is there any other way?

- Matt
This topic is locked and can not be replied to.