Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Default id Attribute Option for ButtonType in Symfony Forms #58222

Closed
FACHINA opened this issue Sep 10, 2024 · 4 comments
Closed

Add Default id Attribute Option for ButtonType in Symfony Forms #58222

FACHINA opened this issue Sep 10, 2024 · 4 comments

Comments

@FACHINA
Copy link

FACHINA commented Sep 10, 2024

Symfony version(s) affected

5.4.31

Description

When using a ButtonType in a form, the button does not have a specified id attribute by default. This results in the button being impossible to reference or submit in some cases where the id is required for JavaScript or CSS selectors.

How to reproduce

Create a Symfony Form: Define a form with a ButtonType without explicitly setting an id attribute.

$builder->add('submit', ButtonType::class, [ 'label' => 'Submit', ]);

Attempt to Submit the Button..

Possible Solution

Add a default id attribute on form

Additional Context

No response

@xabbuh
Copy link
Member

xabbuh commented Sep 11, 2024

What would be the advantage of a dedicated option compared to setting it with the attr option?

@FACHINA
Copy link
Author

FACHINA commented Sep 11, 2024 via email

@xabbuh
Copy link
Member

xabbuh commented Sep 16, 2024

Re-reading the issue and looking at the code of our form themes I think what you request here should already be happening. Could it be that you use a custom form theme?

@xabbuh
Copy link
Member

xabbuh commented Sep 23, 2024

I am going to close here for now due to the lack of feedback. Please let us know when you have more information and we can consider to reopen.

@xabbuh xabbuh closed this as not planned Won't fix, can't repro, duplicate, stale Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants