4
When I submit a form, by onsubmit(checkFormIsCorrect())
, call this javascript function that will validate various situations and submit or not the form.
In this capacity:
function checkFormIsCorrect() {
if (!$('div.has-error').length > 0) {
return displayAlertify('confirm',
'Confirme todos os dados antes de submeter');
}
return false;
}
The function displayAlertify(...)
shows a box with the buttons "OK" and "CANCEL", returning true
or false
.
The problem is that I can’t stop code execution until I receive the function’s Return displayAlertify(...)
.
did not miss the
e.preventDefault()
?– Marconi
posts your html code.
– Allan Andrade
I couldn’t understand your problem properly. What is your goal?
– Andrew Ribeiro
<form onsubmit="Return checkFormIsCorrect();" class="form_1" method="post"> .... ..... <div class="form_line"> <button type="Submit" class="btn btn2 btn-Primary btn-block" name="submit_new_user">Register</button> </div> </form>
– M_b_85
The goal is to be able to confirm or cancel the submission of the form by clicking on the 'OK' or 'CANCEL' buttons'
– M_b_85
You should show how you declare
displayAlertify
– Klaider
Function displayAlertify(message) { alertify.confirm(message, Function(e) { if(e) { Return true; } Else { Return false; } }); }
– M_b_85