form inside a form

Hi

     I have a main form like below

<%= start_form_tag ({:action => 'update_sd_ticket', :method =>
'post',:id =>@sd_ticket.id})%>
<table>
<tr>
    <th width=""><label for="" >SD Ticket</label></th>
    <td colspan="" width=""><%=h @sd_ticket.number %></td>
</tr>
</table>
<ul id="sdmaintab" class="shadetabs">
<li><a href="#" rel="view_sd_resolution_details">Resolution</a></li>
</ul>

<div id="sddetails" class="tabcontent">
<%= render :partial=>'service_desk_part/edit_sd_details' %>
</div>
<div id="view_sd_resolution_details" class="tabcontent">
<%= render :partial => 'service_desk_part/view_sd_resolution_details' %>
</div>

<%= end_form_tag %>

AND INSIDE THE PARTIAL FILE view_sd_resolution_details (which is
completely inside a div)a link_to_remote is there which replaces this
div and the file define_sd_resolution_ui is called ..(This is working)
and in that the following form is there.

<%= form_remote_tag :url => { :action => 'sd_resolution_save',
                               :id => @sd_ticket.id,
:sd_resolution_id=>@sd_resolution_id, :page => params[:page]},
                               :class => 'itilform'%>

<tr>
    <th width="25%"><label for="" >Resolution</label></th>
    <td width="75%"><%= text_area("sd_resolution", "resolution", "cols"
=> 80, "rows" => 5) %></td>
  </tr>
<%= end_form_tag>

BUT THIS FORM ACTION DOES NOT WORK..HOW CAN I OVERCOME THIS?

Sijo

taken from w3c (http://www.w3.org/TR/REC-html32):

"FORM fill-out forms
    Requires start and end tags. This element is used to define a
fill-out form for processing by HTTP servers. The attributes are ACTION,
METHOD and ENCTYPE. Form elements can't be nested."

--> you can't put a <form> tag inside a <form> ancestor tag , and that
is pretty much what you are doing. you have to seperate the two.

Sijo:

This is the very same issue that you posted earlier:
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/86adead2460b6ffe/cf2b5a0a344c07a5?lnk=gst&q=Sijo+form+partial#cf2b5a0a344c07a5

I don't want to discourage you from using Rails, but please do slow
down a bit and study what you are working with. You are posting a lot
of questions and many of the answers share the same or similar root
causes.

Handle the issue of subforms you need to read up on the API regarding
the fields_for method. See ActionView::Helpers::FormHelper.

Hi Sijo,

Watch the following Railscasts that might give you ideas on how to solve your problem:

Episode 16: Virtual Attributes

Complex Forms Part 1

Complex Forms Part 2

Complex Forms Part 3

Another trick is to have multiple forms but with submit buttons targeting a specific form. i.e.

<fieldset>

	<legend><span>Details</span></legend>

	<ol>

		<li>

			<label for="action_title">title :</label>

			<input id="action_title" name="action[title]" type="text" value="" />

		</li>

	</ol>

</fieldset>
<li>

	<label for="another_action_title">title :</label>

	<input id="another_action_title" name="another_action[another_action_title]" type="text" />

</li>

<li>

	<div id="another_action_button">

		<div class="buttons">

			<button type="submit">Upload</button>

		</div>

	</div>

</li>

<button type="submit" onclick="document.forms['action_edit'].submit();">

Hope this was of help…

Cheers,

Maruis Marais

Hi
   Thanks for your help

Sijo