Creating Tabular FormBuilder - Form/Table Tag Order


I am using a FormBuilder to help with DRY-out my views where forms are displayed in tables. However most examples of this seem to use the same approach of using a view helper to combine the call to the remote_form_for (etc...) method with the encapsulating table tags.

Doing it this way you end up with <table><form></form></table> which isn't strictly valid and which Firefox enforces although IE doesn't. Hence everything displays okay in IE but not Firefox.

Has anyone used a technique to get around this? Does it involve overriding the remote_form_for (as used in this case) helper like I do with the other form helper methods, somehow inserting <table> tags inside the generated <form> tags?

Form helper method used in place of basic remote_form_for helper:

def tabular_remote_form_for(name, *args, &proc)

   # concat("<table class='style3'>", proc.binding)    options = args.last.is_a?(Hash) ? args.pop : {}    options = options.merge(:builder => TabularFormBuilder)    args = (args << options)    remote_form_for(name, *args, &proc)    # concat("</table>", proc.binding)


...and in the view

<% tabular_remote_form_for :product, :url => product_path(@product), :html => { :method => :put } do |form| %>

    <table class="style3">         <%= render :partial => 'form', :locals => { :form => form } %>     </table>

<% end %>

Thanks, Andrew

I should also say, the code shows how I am currently avoiding the issue by manually adding <table> tags to each form. Ideally these should be inserted by the builder.