You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i'm using a table with an HTML5 form in a hidden column per row and references to the form from the input elements according to the HTML5 spec. in this case no 'block' is needed as we just want to have the form tag in isolation.
Expected behavior
form_with should always render a proper form tag and form closing also when no block is passed
Actual behavior
form_with renders the form tag with the standard hidden fields in the first row but it fails to render the closing tag, causing the browsers to get confused.
empty forms might seem strange but in modern html it's possible to refer to a form from a button that is not nested within the form itself, which is often really handy to avoid form nesting, or have issues with form/table combinations.
System configuration
Rails version: 5.2.1 Ruby version: 2.5.1
still an issue on
Rails version: 7.0.5 Ruby version: 3.2.2
The text was updated successfully, but these errors were encountered:
@koenhandekyn, I've managed to reproduced the issue and i've fixed it, I'll create a pull request.
The issue can also be reproduced using the form_tag helper. Basically, what happens is that form_with and form_tag doesn't return a </form> string at the end, and I think the browser deals with the issue by removing the second form for some reason.
koenhandekyn
changed the title
form_with doesn't render form tag itself when no block is passed from second call onward
form_with doesn't render closing tag if no block is given (causing 'confusion' in the browser)
May 30, 2023
Steps to reproduce
i'm using a table with an HTML5 form in a hidden column per row and references to the form from the input elements according to the HTML5 spec. in this case no 'block' is needed as we just want to have the form tag in isolation.
Expected behavior
form_with should always render a proper form tag and form closing also when no block is passed
Actual behavior
form_with renders the form tag with the standard hidden fields in the first row but it fails to render the closing tag, causing the browsers to get confused.
not closing the form tag
closing the form tag (empty block)
key use case
empty forms might seem strange but in modern html it's possible to refer to a form from a button that is not nested within the form itself, which is often really handy to avoid form nesting, or have issues with form/table combinations.
System configuration
Rails version: 5.2.1
Ruby version: 2.5.1
still an issue on
Rails version: 7.0.5
Ruby version: 3.2.2
The text was updated successfully, but these errors were encountered: