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

Form submission: Identify pressed submit button associated through form attribute #5190

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

raviks789
Copy link
Contributor

@raviks789 raviks789 commented Feb 20, 2024

Issue

When there are multiple submit buttons outside the form which are associated with it as shown below, the form fails to correctly identify the pressed submit button.

<html>
  <form id="test-form">
    <input type="text" name="name"/>
    <input value="Save" name="save" type="submit">
  </form>
  
  <div>
    <button type="submit" form="test-form" name="button-1">Button 1</button>
    <button type="submit" form="test-form" name="button-2">Button 2</button>
  </div>
</html>

Solution

In case the button is undefined upon submit event, get the pressed submit button using the submitter property found on the SubmitEvent interface.

Depends on #5191.

@raviks789 raviks789 self-assigned this Feb 20, 2024
@cla-bot cla-bot bot added the cla/signed label Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant