Skip to content

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

Merged
nilmerg merged 1 commit into
mainfrom
fix/multiple-external-submit-buttons
Nov 4, 2024
Merged

Form submission: Identify pressed submit button associated through form attribute#5190
nilmerg merged 1 commit into
mainfrom
fix/multiple-external-submit-buttons

Conversation

@raviks789
Copy link
Copy Markdown
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.

Comment thread public/js/icinga/events.js Outdated
@nilmerg nilmerg force-pushed the fix/multiple-external-submit-buttons branch 2 times, most recently from 823dd53 to 8f277bf Compare November 4, 2024 15:00
@nilmerg nilmerg force-pushed the fix/multiple-external-submit-buttons branch from 8f277bf to ee57aee Compare November 4, 2024 15:02
@nilmerg nilmerg added this to the 2.12.2 milestone Nov 4, 2024
@nilmerg nilmerg added enhancement New feature or improvement area/javascript Affects the javascript framework labels Nov 4, 2024
@nilmerg nilmerg assigned nilmerg and unassigned raviks789 Nov 4, 2024
@nilmerg nilmerg merged commit eef276b into main Nov 4, 2024
@nilmerg nilmerg deleted the fix/multiple-external-submit-buttons branch November 4, 2024 15:07
nilmerg added a commit to Icinga/icinga-notifications-web that referenced this pull request Sep 1, 2025
Use a single form for event rule configuration.

Blocked by Icinga/icingaweb2#5190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/javascript Affects the javascript framework cla/signed enhancement New feature or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants