This is the jQuery code:
$(document).ready(function(){
$("#digitalchange").validate({
rules: {
addbalance: {
digits:true,
min:20,
max:1000
},
addquota: {
digits:true,
min:5,
max:1000
},
reducequota: {
digits:true,
min:1,
max:50
}
},
submitHandler: function() {
var var1=$('#addquota').val();
var var2=$('#reducequota').val();
if(var1!='' && var2!='') {
alert('You can only add shortall or reduce shortall.');
return false;
}
return true;
},
messages: {
}
});
});
The problem is that the form of digitalchange won't submit no matter how. When I comment out
submitHandler: function(){
var var1=$('#addquota').val();
var var2=$('#reducequota').val();
if(var1!='' && var2!='') {
alert('You can only add shortall or reduce shortall.');
return false;
}
return true;
},
then the form can be submitted. What's wrong?
I changed return true;
to $("#digitalchange").submit();
, the form can be submitted. However, there is a significant(or obvious) delay before submit when I click the "submit" button, what's wrong? How to get rid of the delay?
submitHandler: function(form) {
var var1=$('#addquota').val();
var var2=$('#reducequota').val();
if(var1!='' && var2!='') {
alert('You can only add shortall or reduce shortall.');
return false;
}
form.submit();
},
does not work.