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:

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:

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,

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.

On Jan 12, 12:30 pm, “[email protected]