1
0
-1

The below codes is executed even if the form validator is not valid

Is there a way to prevent executing 'testing' if the form is not valid or an event that is handled after the form is submitted and is valid

function testing(){

}

$("#form_id" ).submit(function( event ){
 testing();
 });
$('#submit,#assignmentComplete').on('click',function(event){
testing();
});

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi, your code is executed on the client browser, but validation is actually performed at the server-side for security. You should either place your logic in a post processing tool, or in a script in another subsequent form or page after successful submission.

        CommentAdd your comment...