# Two start\_form\_tag and 2 submit button in one rhtml file

**URL:** <https://www.ruby-forum.com/t/two-start-form-tag-and-2-submit-button-in-one-rhtml-file/130329>\
**Category:** Rails\
**Created:** [February 27, 2008, 12:43pm UTC](https://www.ruby-forum.com/t/two-start-form-tag-and-2-submit-button-in-one-rhtml-file/130329 "2008-02-27T12:43:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [February 27, 2008, 12:43pm UTC](https://www.ruby-forum.com/t/two-start-form-tag-and-2-submit-button-in-one-rhtml-file/130329/1 "2008-02-27T12:43:42Z")

</div>

Hi

I have a file edit.rhtml

\<%= start\_form\_tag ({ :action =\> ‘update’, :id =\> @ci, :method =\>  
‘post’}, :class =\> ‘itilform’, :enctype =\> ‘multipart/form-data’,  
:onSubmit =\> ‘return validate\_form();’)%\>

\<% if @ci.citype== '1' %\> \<%= render :partial=\>'cipart/edit\_hardware\_ci' %\> \<% end %\>

| 

Save

 |

\<%= end\_form\_tag %\>

In partial file \_edit\_hardware\_ci.rhtml there is another  
start\_form\_tag and submit tab.The File is as folliows

\<%= start\_form\_tag ({:controller =\> ‘ci’, :action =\>  
‘edit\_ci\_functional\_spec’, :ci =\> @ci, :method =\> ‘post’}, :class =\>  
‘itilform’)%\>

| \<%= text\_area "ci\_content", "functional\_spec", "cols" =\> 120, "rows" =\> 5 %\> |

| \<%#= submit\_tag('Save') %\> Save |

\<%= end\_form\_tag %\>

BUT SUBMIT BUTTON IN THE PARTIAL FILE CALLS THE ACTION IN  
EDIT.RHTML…HOW CAN I CALL THE ACTION SPECIFIED IN THE STRAT FORM TAG  
OF PARTIAL FILE \_EDIT\_HARDWARE\_CI.RHTML

Sijo

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [February 27, 2008, 3:39pm UTC](https://www.ruby-forum.com/t/two-start-form-tag-and-2-submit-button-in-one-rhtml-file/130329/2 "2008-02-27T15:39:58Z")

</div>

This is not really a Rails issue, but a HTML form issue. In short,  
you’re not allowed to nest forms. You’ve effectively done that by  
wrapping a form around the table that includes the partial (which also  
wraps a form around a table).

IMO, the best thing to do is rethink the UI structure to avoid the  
nesting. If you cannot achieve that then you could use a  
button\_to\_function and supply it a remote\_function that uses  
the :submit param to send your _inner_ (partial) form.
