Skip to content

Conversation

@daun
Copy link
Member

@daun daun commented Mar 12, 2025

Description

  • Check for prevented submit events before submitting forms
  • Allow preventing form submission using standard event handling
  • Work in progress

Example usage

swup.hooks.before('form:submit', (visit, { el: form, event }) => {
  if (form.dataset.submitting) {
    event.preventDefault()
  }
  form.dataset.submitting = true
})

Checks

  • The PR is submitted to the main branch
  • The code was linted before pushing (npm run lint)
  • All tests are passing (npm run test)
  • New or updated tests are included
  • The documentation was updated as required

Additional information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Unintentional consecutive form submissions

2 participants