Skip to content

Form block doesn't trigger submit event #360

Open
@chicharr

Description

Expected Behaviour

When a form is submitted a submit event is triggered for the form.

Actual Behaviour

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

Reproduce Scenario (including but not limited to)

https://www.hlx.live/developer/forms

Steps to Reproduce

  1. In your chrome browser open: https://www.hlx.live/developer/forms
  2. Open developer tools -> Console and add a submit listener on the form element. e.g.:document.getElementsByTagName('form')[0].addEventListener('submit', (e) => {console.log('form submitted');})
  3. Scroll down to the sample form in the page, enter some data and click submit button.
  4. Notice that in the browser Console, there is no message form submitted

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions