Feature request: Allow us to abort / prevent the onSubmit
vesper8 opened this issue · comments
Currently if you map the submit action to a method, you cannot simply return false
and prevent clicking the submit button unless a custom condition is true.
Hi @vesper8,
thanks for the suggestion, but unfortunately this is impossible with Vue's event handling since with $emit
you don't get a reference to the event that Vue emits (neither when you emit it nor in the listener itself), so you can't call event.preventDefault()
nor can we check if defaultPrevented
is true. Small note here - return false
does nothing with regular DOM2 events (added with addEventListener
) so it's safe to assume Vue won't do anything here in this case as well. We might be able to do a hacky workaround here and dispatch a native CustomEvent
but this would be a backwards incompatible change which would break the API, and which would also be against Vue conventions and recommendations so we wouldn't really want to go down this route.
What you could do is override the completeButton
slot and do your custom logic there. Or of course if you have any suggestions how we could handle your initial request, feel free to let us know (or even create a PR).