The below code blocks any non-ajax form from submitting.
$(this.form)
.on('submit', function(event) {
if (/* Some condition */) {
event.preventDefault();
}
});
In Drupal 8, how can we block an Ajax form from being submitted?
Ajax forms do not trigger a form submit handler and I have not been able to block the click event on an Ajaxified form's submit buttons.
For reference, I am trying to fix Issue #3010084: Form submission finishes before file upload is complete