Forms

Is there a way to trigger a submit of a form by a link outside of the
form. For example:

<% form_tag do %>

Name: <%= text_field_tag :name, params[:name] %> Password: <%= password_field_tag :password, params[:password] %> <%= submit_tag "Login" %> <% end %>

Instead of having the submit button which is located inside of the <%
form_tag do %> <% end %> is it possible to place a link after the <% end
%> which will trigger the submit of the form.

I am trying to keep things consistent on a project I am working on and
all the navigation from one page to the next is done with a link located
in the layout. I would like to keep this the same but have a form in
one of the views with no submit button. Any suggestions?

The code above is not the actual example, I just thought something
visual would help explain.

Thanks in advance

On 13 Mar 2008, at 19:10, Chris H. wrote:

Is there a way to trigger a submit of a form by a link outside of the
form. For example:

Instead of having the submit button which is located inside of the <%
form_tag do %> <% end %> is it possible to place a link after the <%
end
%> which will trigger the submit of the form.

You can with javascript: $(‘my_form’).submit();

Fred

To take that one step more, it would be Submit the form

On Mar 13, 12:34 pm, Frederick C. [email protected]