When I submit a form, through onsubmit(checkFormIsCorrect())
, I call this javascript function that will validate several situations and submit or not the form.
In this function:
function checkFormIsCorrect() {
if (!$('div.has-error').length > 0) {
return displayAlertify('confirm',
'Confirme todos os dados antes de submeter');
}
return false;
}
The displayAlertify(...)
function shows a box with the "OK" and "CANCEL" buttons, returning true
or false
.
The problem is that I can not stop the execution of the code until I get the return of the displayAlertify(...)
function.