$("#da-ex-validate2").validate({
rules: {
details: {
required: true,
rangelength: [1, 500]
},
editor1: {
required: true,
minlength: 1
},
title: {
required: true,
rangelength: [1, 100]
},
SlideDeckPhoto: {
required: "#iButton:checked",
accept: ['.jpeg', '.png', '.jpg', '.gif']
},
min1: {
required: true,
digits: true,
min: 5
},
max1: {
required: true,
digits: true,
max: 5
},
submitHandler: function(form) {
$(form).ajaxSubmit();
},
range1: {
required: true,
digits: true,
range: [5, 10]
}
},
invalidHandler: function (form, validator) {
var errors = validator.numberOfInvalids();
if (errors) {
var message = errors == 1
? 'You missed 1 field. It has been highlighted'
: 'You missed ' + errors + ' fields. They have been highlighted';
$("#da-ex-val2-error").html(message).show();
} else {
$("#da-ex-val2-error").hide(); // it's not work !!! and the page is reload !!
}
}
});
我还想在不重新加载页面的情况下将表单值保存到 MySql。请帮忙 !我读了很多帖子,尝试了很多东西!如果你放了一个代码,请告诉它放在哪里..顺便说一句,我的表单输入字段很少,还有一个文件输入字段。请帮忙 !