helix-website icon indicating copy to clipboard operation
helix-website copied to clipboard

[360] Use submit event for form submission

Open chicharr opened this issue 2 years ago • 3 comments

Description

Form block uses

Related Issue

#360

Motivation and Context

Forms are submitted by a listener on the click event of the submit button. The payload is generated and POST'ed as a json via fetch API. This prevents the triggering of the submit event.

This behaviour prevents other features such as RUM or Conversion tracking to work automatically, as they listen to submit events

How Has This Been Tested?

  • Run the project locally.
  • On chrome browser open: https://www.hlx.live/developer/forms
  • Open developer tools -> Console and add a submit listener on the form element. document.getElementsByTagName('form')[0].addEventListener('submit', (e) => {console.log('form submitted');})
  • Scroll down to the sample form in the page, enter some data and click submit button.
  • Validate that in the browser Console, there is a message form submitted
  • Check that POST fetch request is still sent
  • Check that redirection after submit is still happening

Screenshots (if appropriate):

Types of changes

  • [X] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [X] I have signed the Adobe Open Source CLA.
  • [ ] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [X] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.
  • [X] All new and existing tests passed.

chicharr avatar Aug 21 '23 13:08 chicharr

Hello, I'm Franklin Bot and I will run some test suites that validate the page speed. In case there are problems, just click the checkbox below to rerun the respective action.

  • [ ] Re-run PSI Checks

aem-code-sync[bot] avatar Aug 21 '23 13:08 aem-code-sync[bot]

hte5au4a336a

trieloff avatar Sep 28 '23 09:09 trieloff

Seems outdated. Closing for now, feel free to reopen and refresh if needed.

kptdobe avatar Dec 24 '24 09:12 kptdobe