Two start_form_tag and 2 submit button in one rhtml file

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();')%> <table cellpadding="4" cellspacing="0" border="0" width="100%" class="itiledittable1"> </table> <% if @ci.citype== '1' %> <%= render :partial=>'cipart/edit_hardware_ci' %> <% end %> <table>   <tr>   <td>

  <button type="submit" value="save" class="itilsubmitbutton1" onmouseover="this.className='itilsubmitbutton1hover'" onmouseout="this.className='itilsubmitbutton1'">Save</button>   </td> </tr> </table>

<%= 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')%> <table cellpadding="4" cellspacing="0" border="0" width="100%" class="itiltable2"> <tr>     <td width="25%" colspan="4"><%= text_area "ci_content", "functional_spec", "cols" => 120, "rows" => 5 %></td> </tr> </table> <table>   <tr>   <td>   <%#= submit_tag('Save') %>   <button type="submit" value="save" class="itilsubmitbutton1" onmouseover="this.className='itilsubmitbutton1hover'" onmouseout="this.className='itilsubmitbutton1'">Save</button>   </td>    </tr> </table> <%= 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

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.