How to using jQuery function
I'm using this jQuery function but when user press login and the username or password is incorrec, how am I show the error message? Becuase when user click submit button it will redirect to login_validation.php to do the verification checking. And in the login_verification.php I'm using if..else statement to do. How am I going to show error if the username or password is wrong and I want it pop out in the login page not the other page.
- <script>
jQuery(document).ready(function(){
// binds form submission and fields to the validation engine
jQuery("#formID").validationEngine();
$("#formID").bind("jqv.form.validating", function(event){
$("#hookError").html("")
})
$("#formID").bind("jqv.form.result", function(event , errorFound){
if(errorFound) $("#hookError").append("Invalid username or password.");
})
});
/**
*
* @param {jqObject} the field where the validation applies
* @param {Array[String]} validation rules for this field
* @param {int} rule index
* @param {Map} form options
* @return an error string if validation failed
*/
function checkHELLO(field, rules, i, options){
if (field.val() != "HELLO") {
// this allows to use i18 for the error msgs
return options.allrules.validate2fields.alertText;
}
}
</script>