ES
2010-Apr-12 16:24 UTC
clicking to add content is adding it outside of the page''s table
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:
<table style="width:100%" >
<tbody class="fields">
<% 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 %>
</tbody>
</table>
My partial:
<div class = "fields">
<tr><td><%= f.label(:treatmenttype, "type de
traitement") %></td>
<td><%= f.text_field :treatmenttype %></td></tr>
<tr><td><%= f.label(:treatmenttype, "commentaires sur la
preparation")
%></td>
<td><%= f.text_field :preparation %></td></tr>
<tr><td><%= f.hidden_field :_destroy %> </td></tr>
<tr><td><%= link_to_remove_fields "remove", f
%></td></tr>
</div>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
ES
2010-Apr-12 16:27 UTC
clicking to add content is adding it outside of the page''s table
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
http://railscasts.com/episodes/197-nested-model-form-part-2
My view file:
<table style="width:100%" >
<tbody class="fields">
<% 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 %>
</tbody>
</table>
and my partial:
<div class = "fields">
<tr><td><%= f.label(:treatmenttype, "type de
traitement") %></td>
<td><%= f.text_field :treatmenttype %></td></tr>
<tr><td><%= f.label(:treatmenttype, "commentaires sur la
preparation")
%></td>
<td><%= f.text_field :preparation %></td></tr>
<tr><td><%= f.hidden_field :_destroy %> </td></tr>
<tr><td><%= link_to_remove_fields "remove", f
%></td></tr>
</div>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2010-Apr-12 16:38 UTC
Re: clicking to add content is adding it outside of the page''s table
On Mon, Apr 12, 2010 at 9:24 AM, ES <emstolfo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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.> <table style="width:100%" > > <tbody class="fields"> > <% 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 %> > </tbody> > </table> > > My partial: > > <div class = "fields"> > > <tr><td><%= f.label(:treatmenttype, "type de traitement") %></td>A DIV can''t be a child of TBODY; lose those tags and it''ll probably work. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
ES
2010-Apr-12 16:50 UTC
Re: clicking to add content is adding it outside of the page''s table
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 Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mon, Apr 12, 2010 at 9:24 AM, ES <emsto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. > > <table style="width:100%" > > > <tbody class="fields"> > > <% 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 %> > > </tbody> > > </table> > > > My partial: > > > <div class = "fields"> > > > <tr><td><%= f.label(:treatmenttype, "type de traitement") %></td> > > A DIV can''t be a child of TBODY; lose those tags and it''ll probably > work. > > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2010-Apr-12 17:14 UTC
Re: Re: clicking to add content is adding it outside of the page''s table
On Mon, Apr 12, 2010 at 9:50 AM, ES <emstolfo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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: >> >> > <div class = "fields">So lose this div and just have your TR rows there. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Apr-12 18:43 UTC
Re: Re: clicking to add content is adding it outside of the page''s table
On 12 April 2010 18:14, Hassan Schroeder <hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mon, Apr 12, 2010 at 9:50 AM, ES <emstolfo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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: >>> >>> > <div class = "fields"> > > 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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.