# Creating Tabular FormBuilder - Form/Table Tag Order

**URL:** <https://www.ruby-forum.com/t/creating-tabular-formbuilder-form-table-tag-order/130022>\
**Category:** Rails\
**Created:** [February 24, 2008, 1:02pm UTC](https://www.ruby-forum.com/t/creating-tabular-formbuilder-form-table-tag-order/130022 "2008-02-24T13:02:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![reynar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e99b99/32.png) [@reynar](https://www.ruby-forum.com/u/reynar)\
**Post date:** [February 24, 2008, 1:02pm UTC](https://www.ruby-forum.com/t/creating-tabular-formbuilder-form-table-tag-order/130022/1 "2008-02-24T13:02:43Z")

</div>

Hi,

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

 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

 tags  
inside the generated tags?

Form helper method used in place of basic remote\_form\_for helper:

def tabular\_remote\_form\_for(name, \*args, &proc)

# concat("

", 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("

", proc.binding)

end

…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

---

<div class="post-metadata">

**Author:** ![reynar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e99b99/32.png) [@reynar](https://www.ruby-forum.com/u/reynar)\
**Post date:** [February 24, 2008, 1:05pm UTC](https://www.ruby-forum.com/t/creating-tabular-formbuilder-form-table-tag-order/130022/2 "2008-02-24T13:05:40Z")

</div>

I should also say, the code shows how I am currently avoiding the  
issue by manually adding

 tags to each form. Ideally these  
should be inserted by the builder.
