laker
laker

Reputation: 599

Rails 3: form_for missing closing </form> tag

I am using a form_for in one of my views in my rails app, but for some reason the closing tag is not being generated, and this will be handled safely in most browsers, except IE 8 and lower.

Here's some sample code:

<%= form_for object, :remote => true, :url => remote_update_path, :html => {:name => "form_#{id_number}", :id => "form_#{id_number}"} do |f| %>
    <%= hidden_field_tag "field_a", object[:field_a] %>
    <ul class="class1">
        <li> <%= f.check_box :field_b, :class => "class2", :id => "b"  %> B</li>
        <li> <%= f.check_box :field_c, :class => "class2", :id => "c" %> C</li>
    </ul>
 <% end %>

For some reason this isn't generating the closing </form> tag where <% end %> is located. (I know there is now submit button in the form, this does not affect the missing </form>.)

Is this a bug? or is there something that I'm doing wrong?

Upvotes: 0

Views: 722

Answers (2)

New to Rails
New to Rails

Reputation: 2942

I had the same issue. It happened to me because I didn't close one div tag properly inside the forms.

Upvotes: 1

Brad Werth
Brad Werth

Reputation: 17647

This is almost certainly happening as a result of invalid HTML somewhere on the page. Run it through the validator, until it's all passing, and I bet the problem goes away...

Upvotes: 1

Related Questions