Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Form] Form ID is not set on form element #42075

Closed
@ker0x

Description

@ker0x

Symfony version(s) affected: 5.3

Description

When a form is render, the ID of the form is set on a div inside the form while it should be set on the form element itself.
This prevent to render a button outside the form element with a form attribute. It also prevent to use the form_attr option on a form.

Actual behavior

<form name="user" method="post">
    <div id="user">
         // ... fields
    </div>
</form>

<button type="submit" form="user">Save</button>

Expected behavior

<form id="user" name="user" method="post">
    // ... fields
</form>

<button type="submit" form="user">Save</button>

How to reproduce

Reproducer

See README

Possible Solution

Instead of setting the ID in a div, set it on the form directly.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions