I'm doing an ajax validation for duplicate check on link field in node form. When the link field is edited, an ajax call is triggered as programmed (using form api #ajax default blur event), it takes a while for the ajax response to reach browser, in the meantime the form gets almost ready to submit by user. Doing an early form submit (i.e before the receipt of ajax response) Drupal ajax API throws below error message in JavaScript alert box,
An AJAX HTTP request terminated unexpectedly Debug information follows. Path: /system/ajax Status text: Answer Text: Ready State: 4
I have noticed this issue in a few contrib modules as well. I think the fix is to prevent submitting the form to server until the ajax request completes. Wondering to know if there is any way to set client side callback function in form api that I can use to stop form submit.