# 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/186809>\
**Category:** Rails\
**Created:** [April 12, 2010, 6:29pm UTC](https://www.ruby-forum.com/t/clicking-to-add-content-is-adding-it-outside-of-the-pages-table/186809 "2010-04-12T18:29:16Z")\
**Posts on this page:** 1\
**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:29pm UTC](https://www.ruby-forum.com/t/clicking-to-add-content-is-adding-it-outside-of-the-pages-table/186809/1 "2010-04-12T18:29:16Z")

</div>

Clicking the “add” button in my nested form is adding the content  
outside of the page’s main table, how can I get it to add the html  
into the table that the link is contained in?

I followed the Railscast

> **[\#197 Nested Model Form Part 2 - RailsCasts](http://railscasts.com/episodes/197-nested-model-form-part-2)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

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 %>

```

and 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 %\>
