Update to form validation in #1182 has removed form submit event #1199
Labels
release/13.1.2
state/sprint-candidate
We're trying to get this in a sprint at HQ in the next few weeks
type/bug
The update in #1182 has resulted in a form's
submit
event not being raised when submitted.The following code has been implemented and will trigger the form to be submitted but it will not raise a
submit
event:This is an issue because there will be sites which rely on the the submit event for form and field manipulation, tracking etc.
Solution
Using
form.requestSubmit()
instead ofform.submit()
in following code will do the same and raise the form'ssubmit
event:The details of this are found here:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/requestSubmit and
https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/requestSubmit#usage_notes
Browser Support
Given that
form.requestSubmit()
is not supported by older browsers (https://caniuse.com/?search=requestSubmit), it might be worth considering implementing a polyfill, e.g. https://github.com/javan/form-request-submit-polyfill.The text was updated successfully, but these errors were encountered: