我目前有一个注册表格,需要2个教育日期,开始日期和结束日期。我的验证适用于除这些日期之外的所有输入字段。我需要他们检查开始日期是否在结束日期之前。
我目前正在http://xdsoft.net/jqplugins/datetimepicker/
的库中使用datetimepicker我已经在网上看过使用通常的jquery库的例子,但不是这个特别的例子,我对如何进行验证感到有些困惑。
INITIALISES DATETIMEPICKER
jQuery('#datetimepicker_start_time').datetimepicker({
startDate:'+1971/05/01'//or 1986/12/08
});
JQUERY VALIDATION
<script>
$(function() {
$("#book-form").validate({
// Specify the validation rules
rules: {
firstname: "required",
lastname: "required",
start_education_date: "required",
end_education_date: "required",
email: {
required: true,
email: true
},
password: {
required: true,
minlength: 5
},
agree: "required"
},
// Specify the validation error messages
messages: {
firstname: "Please enter your first name",
lastname: "Please enter your last name",
password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long"
},
email: "Please enter a valid email address",
agree: "Please accept our policy"
},
submitHandler: function(form) {
form.submit();
}
});
});
</script>