form_for hidden _method input, wrapped in div?!

Hi,

I'm rendering a form using form_for, and Rails (2.0.2) is automatically generating the _method tag for me. Great! But why would the Rails team decide to wrap the thing in a div tag? Here is the output I'm getting:

<form action="/admin/content_blocks/1/publish" class="edit_content_block" id="PublishContentBlock" method="post">   <div style="margin:0;padding:0"><input name="_method" type="hidden" value="put" /></div>   <input id="PublishContentBlock" name="commit" type="submit" value="Publish this Content Block" /> </form>

This is my code used to generate that:

<% form_for object, :url=>publish_admin_content_block_path(@object), :html=>{:id=>'PublishContentBlock'} do |f| %>   <%== submit_tag 'Publish this Content Block', :id=>'PublishContentBlock' %> <% end %>

I need to display a button that's in a different form, but have the button appear next to (after, inline) the previous forms buttons. How can I do this is the styles are hard-coded into the div tag that wraps the hidden _method tag?

Matt

The 'div' is there for HTML validation. This is not valid HTML:

<form><input/></form>

Input elements must be wrapped in another valid element. In this case, the Rails team used the generic 'div' tag.

You could still use CSS to position the two forms next to each other (specify, at least, a width, and float them both left).

I ran into this 'div' with the hidden field recently. First, <form><input/><form> is absolutely valid xhtml transitional. It's only invalid if you're using strict. Even if you are using strict, wrapping a hidden field in a div shows a poor understanding of semantic markup; a div is a generic block-level container for grouping content. If you must wrap the input to validate, fieldset is far more appropriate as a way of grouping form controls. As for positioning, CSS is the appropriate choice.