Performing client-side validations on submit-start and cancel form submission

@tleish The order follows:

  1. submit listener (I throw a debugger in the dist source)
  2. turbo-submit-start

I’ve found a workaround in my case following some of the ideas in the Triggering Turbo Frame with JS thread.

  1. I add date-turbo: false to the form
  2. I add a submit->stripe#submit handler
  3. Call preventDefault() to stop normal browser submission
  4. Check validations
  5. If valid, manually trigger a form submission.

e.g.

// html
= form_with @object { data: { trubo: :false, action: 'submit->stripe#submit' }

// strip_controller.ts
submit(event) {
  event.preventDefault()

  if (valid) {
    navigator.submitForm(...) //manually trigger form submission (runs events like submit-start & submit-end)
  }
}