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

Multiple form JS validation #6815

Open
x140l31 opened this issue Feb 12, 2025 · 0 comments
Open

Multiple form JS validation #6815

x140l31 opened this issue Feb 12, 2025 · 0 comments

Comments

@x140l31
Copy link

x140l31 commented Feb 12, 2025

Describe the bug
When I have multiple forms in a crud page (for example create a new associationfield with a modal), when you press submit button from the modal it will validate the main form.

To Reproduce
EasyAdmin 4.14

Create a new custom form with a submit button in any crud edit/new page and click the submit button.

Additional context
Debugging I think it's because of form.js "#createFieldsWithErrors" function.

handleFieldsWithErrors function is listening to any submit button of the document, I think this should filter submit buttons that are only for given form:

  const submitButtons = form.querySelectorAll('[type="submit"]');
  const externalSubmitButtons = document.querySelectorAll(`[type="submit"][form="${form.id}"]`);
  const allSubmitButtons = [...submitButtons, ...externalSubmitButtons];

  allSubmitButtons.forEach(button => {
....
  });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant