|
|
当用户没有输入用户名还是密码时它就会弹出Invalid username or password,但是当做validation是用户名还是密码错误时,要怎样引用这个jQuery的function呢?我有login.php还有login_validation.php。login.php只是普通的表格而login_validation.php就是做验证。而我的jQuery是在login.php里面。- <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.");
- })
- });
- 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>
复制代码 |
|