html - div inside form rails -
i have these markup on rails application these form not working when tr
<div class="span5 mg myform"> <div class="span5 mg"> <ul class="clearfixremo formmenu"> <li class="lefty blocky boldy rightbrd"><i class="icon-pencil"></i> post</li> <li class="lefty blocky boldy myphotoupload "> <i class="icon-camera"></i> photo</li> </ul> </div> <div class="span5 mg"> <div class="row"> <div class="span4"> <%= simple_form_for(current_user.posts.new, :remote => true ,:html => { :multipart => true } ,:class=>"form-horizontal" ) |f| %> <div class="field"> <%= f.text_area :body ,:rows=>1%> <%= f.select :privacy,["public","friends","only me"] %> </div> </div> </div> </div> <div class="span5 mg"> <div id="pactions" class="actions"> <%= f.submit "#{t 'share'}",:id=>"share"%> </div> <% end %> </div> </div> it shows me on html markup form closed before select menu , when move submit button before select menu , inside field div working
fix formatting , indentation of erb , problem should become obvious: opening tags (including <%= ... %>) must match closing tags (including <% end %>). can't:
<div> <form> </div> </form> you need to:
<div> <form> </form> </div> your <form> opens 1 <div>
<%= simple_form_for(current_user.posts.new, :remote => true ,:html => { :multipart => true } ,:class=>"form-horizontal" ) |f| %> <div class="field"> and tries close 4 of them:
</div> </div> </div> </div> when browser sees invalid html, attempt fix closing <form> behind , pretend said:
</div> </form> </div> </div> once happens, form broken , nothing works way you're expecting to.
fix tag nesting closed in opposite order tags opened. , start formatting code structure obvious, computer won't care will.
Comments
Post a Comment