0

I am using jQuery Form Validator with Alertify JS and I am using below code to check if my form successfully validated or not.

onSuccess : function($form) {
  alertify.alert('a callback will be invoked on ok.').set('onok', function(closeEvent) { 
    return true;
  }); 
  return false; // Will stop the submission of the form
},

Here what I am trying to do is, if I press OK From Alertify then my form should be submitted.

But as of now, if I remove return false; then my Alertify not showing and my form gets submited.

I also tried to put $('#my-form-id').submit() inside return true; but yet its not working.

Basically I just want to show my Alertify before form gets submitted just to notify the user with my alert box. But it seems above things not working for me correctly.

Here is the jQuery Form Validator configuration documentation which I have followed.

Can someone guide me what I am doing wrong here ?

5
  • Please check your console in chrome
    – M.Hemant
    Mar 5, 2019 at 11:59
  • I have checked and I am not getting any error in console. Mar 5, 2019 at 12:01
  • yes I just read your link of Alertify
    – M.Hemant
    Mar 5, 2019 at 12:19
  • you have to prevent you submit action. Bcz you submit action refreshing you page that`s why alert wont execute.. If you prevent submit then alert will get execute.. return false is also preventing you submit action
    – Ashu
    Mar 5, 2019 at 12:25
  • yes .. i tried to remove return false and also removed return true and put my form submit jquery code but its still not working. Mar 5, 2019 at 12:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.