I would like the Rails form helper methods to add the form attribute to each form element. The
form attribute should have a value equal to the associated form’s
Why? I was building a page with multiple forms, one of which having inputs defined outside of the
<form> (which is completely legal according to the spec, as long as you define the
form attribute so the browser knows what form to associate the input with). I ran into the issue that the browser was picking up two different hidden
_method input elements, each with a different value, causing Rails to route one of the forms the wrong controller action. By creating a custom form builder I could easily automatically add the
form attribute to all elements created by the builder, but the hidden fields for
authenticity_token are not created by the form builder but by a helper function.
The changes necessary to do this are relatively simple. Just two questions: is this a good idea to add to rails, and if so, should the attribute be added by default or only activated with an option flag?