Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow preventing form submission events #84

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

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
1 participant