# Clicking to add content is adding it outside of the page's table

**URL:** <https://www.ruby-forum.com/t/clicking-to-add-content-is-adding-it-outside-of-the-pages-table/186808>\
**Category:** Rails\
**Created:** [April 12, 2010, 6:26pm UTC](https://www.ruby-forum.com/t/clicking-to-add-content-is-adding-it-outside-of-the-pages-table/186808 "2010-04-12T18:26:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 12, 2010, 6:26pm UTC](https://www.ruby-forum.com/t/clicking-to-add-content-is-adding-it-outside-of-the-pages-table/186808/1 "2010-04-12T18:26:20Z")

</div>

Each time the “add” button in my nested form is clicked, it adds the  
partial to the end of the page, not inside in the table.

My view file:

 \<% echantillon\_form.fields\_for :treatments do |builder| %\> \<%= render :partial =\> "treatment\_fields", :locals =\> {:f =\> builder} %\> \<% end %\>

```
  <%= link_to_add_fields "Add treatment",

```

echantillon\_form, :treatments %\>

```
  <%= echantillon_form.submit "Submit" %>
  <% end %>

```

My partial:

\<%= f.label(:treatmenttype, "type de traitement") %\> \<%= f.text\_field :treatmenttype %\> \<%= f.label(:treatmenttype, "commentaires sur la preparation") %\> \<%= f.text\_field :preparation %\> \<%= f.hidden\_field :\_destroy %\> \<%= link\_to\_remove\_fields "remove", f %\>

---

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 12, 2010, 6:40pm UTC](https://www.ruby-forum.com/t/clicking-to-add-content-is-adding-it-outside-of-the-pages-table/186808/2 "2010-04-12T18:40:23Z")

</div>

On Mon, Apr 12, 2010 at 9:24 AM, ES [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Each time the “add” button in my nested form is clicked, it adds the  
> partial to the end of the page, not inside in the table.

> ```
> <%= echantillon_form.submit "Submit" %>
> <% end %>
> 
> ```
> 
> My partial:
> 
> \<%= f.label(:treatmenttype, "type de traitement") %\>

A DIV can’t be a child of TBODY; lose those tags and it’ll probably  
work.

–  
Hassan S. ------------------------ removed\_email\_address@domain.invalid  
twitter: @hassan

---

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 12, 2010, 6:51pm UTC](https://www.ruby-forum.com/t/clicking-to-add-content-is-adding-it-outside-of-the-pages-table/186808/3 "2010-04-12T18:51:31Z")

</div>

So what can be a child of div? I’ve tried p and that still places the  
new content it outside the table. I have a div encompassing the  
entire page so that it can be formatted with my leftcontainer side  
menu. What tag can I use to insert the html content successfully into  
the table in the page?

On Apr 12, 6:38 pm, Hassan S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 12, 2010, 7:15pm UTC](https://www.ruby-forum.com/t/clicking-to-add-content-is-adding-it-outside-of-the-pages-table/186808/4 "2010-04-12T19:15:31Z")

</div>

On Mon, Apr 12, 2010 at 9:50 AM, ES [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> So what can be a child of div? I’ve tried p and that still places the  
> new content it outside the table. I have a div encompassing the  
> entire page so that it can be formatted with my leftcontainer side  
> menu.

That’s fine but irrelevant – the only child of TBODY is TR.

> > > My partial:
> > 
> > >

So lose this div and just have your TR rows there.

–  
Hassan S. ------------------------ removed\_email\_address@domain.invalid  
twitter: @hassan

---

<div class="post-metadata">

**Author:** ![ESESES](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f0a364/32.png) [@ESESES](https://www.ruby-forum.com/u/ESESES)\
**Post date:** [April 12, 2010, 8:45pm UTC](https://www.ruby-forum.com/t/clicking-to-add-content-is-adding-it-outside-of-the-pages-table/186808/5 "2010-04-12T20:45:06Z")

</div>

On 12 April 2010 18:14, Hassan S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > > >
> 
> So lose this div and just have your TR rows there.

It is also not valid to wrap rows or cells in a form. The form must  
wrap the whole table or fit completely within one cell. As I posted  
in a separate thread check the html using firefox html validator  
or/and the w3c html validator website.

Colin
