Feature idea: remove internal <div> from form_for, form_tag and button_to

Hello Rails team, and thanks for your amazing work!

I would like to create a Pull Request so that form helpers do not add an extra

inside the tag.

I looked back in the history of the code, and I found that the

was initially added after this discussion of 2006 to make forms HTML4 Strict-compliant.

Another message from 2007 confirmed the reason why behind the

.

Now it’s 2014, and HTML 5 finally allows elements to include elements directly, without a wrapping div.

What is your opinion? Should I go on and submit a pull request?

Also… how concerned are you about backward compatibility? If you think it’s appropriate, I could add a new boolean option to “form_for”, “button_to”… so people can decide if they want the

or not.

Thanks! http://github.com/claudiob

I believe this has been added to Rails 4.2/master already: https://github.com/rails/rails/commit/89ff1f82f01bd70e12ec1b45049be30ac262df30

Cheers.

Carlos Antonio, you are right!

I didn’t realize that because the documentation of the method still includes the old format (with the wrapping

s).

I created a PR to update the documentation accordingly: Remove wrapping <div> in form helpers from doc by claudiob · Pull Request #17001 · rails/rails · GitHub

Thanks

Great, thank you.