On Sunday, 10 August 2014 03:14:31 UTC-4, Ruby-Forum.com User wrote:
>
> I have a form like this..
> <div style="padding:13px">
> <%= form_for @lesson do |f| %>
> <%= f.label :lesson_name, "Lesson title" %></br>
> <%= f.text_field :lesson_name, class: "form-control" %></br>
> <%= f.label :lesson_icon, "Choise icon" %>
> <%= f.select "lesson_icon", options_for_select([ "ico-03",
> "ico-04","ico-05","ico-06" ])%></br></br>
>
> <div>
> <%= f.fields_for :sublessons do |sublesson_a| %>
> <div class="add_new_subtitle">
> <%= sublesson_a.label :sublesson_name, "Subtitle 1" %></br>
> <%= sublesson_a.text_field :sublesson_name, class:
> "form-control" %></br>
> <%= sublesson_a.label :sublesson_content, "Content" %></br>
> <%=sublesson_a.text_area 'sublesson_content', rows: 3, class:
> 'form-control'%></br>
> <%= sublesson_a.label :sublesson_video_link, "Video link"
> %><br>
> <%= sublesson_a.text_field :sublesson_video_link, class:
> "form-control" %></br>
> </div>
> </div>
> <%end%>
>
This looks like an "invalid markup" issue. At the top of the section you've
got:
<div>
<%= f.fields_for :sublessons do |sublesson_a| %>
<div class="add_new_subtitle">
but at the bottom you've got
</div>
</div>
<% end %>
So the first time around the loop, the second </div> there closes the
surrounding <div> (the one before f.fields_for). On subsequent iterations,
the </div> is invalid (the next enclosing element is a <form> tag, not a
<div>) but most browsers will try to muddle through, causing weird
rendering.
--Matt Jones
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/b49446ba-dc09-4298-b058-23bb3de64f1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.