So I’m trying to catch the form from submission because it’s a checkout format and I want to do some magic with payment provider JavaScript before I submit something on my backend.
I figured that I can add an event listener this.formTarget.addEventListener("turbo:submit-start", listener)
. But in an ideal world, I want to have an option to cancel it.
Right now I end-up doing event.detail.formSubmission.stop()
during submit-start
, but I still think it’s not ideal way.
Does anyone figure out a way to do this?