# Forms

**URL:** <https://www.ruby-forum.com/t/forms/131851>\
**Category:** Rails\
**Created:** [March 13, 2008, 8:10pm UTC](https://www.ruby-forum.com/t/forms/131851 "2008-03-13T20:10:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [March 13, 2008, 8:10pm UTC](https://www.ruby-forum.com/t/forms/131851/1 "2008-03-13T20:10:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [March 13, 2008, 8:36pm UTC](https://www.ruby-forum.com/t/forms/131851/2 "2008-03-13T20:36:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [March 13, 2008, 11:53pm UTC](https://www.ruby-forum.com/t/forms/131851/3 "2008-03-13T23:53:21Z")

</div>

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

On Mar 13, 12:34 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
