jQuery验证不使用datepicker的dd-M-yy格式

时间:2015-06-29 09:28:59

标签: jquery jquery-ui date datepicker jquery-validate

我正在使用JQuery的{​​{1}} API从文本框中选择值。

这是对DatePicker

的致电
DatePicker

我也使用$(".datefield").datepicker({ changeMonth: true, changeYear: true, dateFormat: 'dd-M-yy' }); 来验证用户输入,如下所示

jQuery.Validate

对于那些意图将日期作为输入的控件,每个验证在chrome中都能正常工作,但是当涉及$("#form_assetDetails").validate({ // Specify the validation rules rules: { Make: { required: true, maxlength: 30 }, ModelName: { required: true, maxlength: 30 }, WarrantyDetail: { required: true, maxlength: 100 }, Capacity: { maxlength: 90 }, WarrantyEndDate: { required: true, date: true }, Quantity: { required: true, number: true, range: [1, 999] }, PurchaseOrderNumber: { required: true, maxlength: 20 }, InvoiceNumber: { required: true, maxlength: 20 }, InvoiceDate: { required: true, date: true }, AdvanceAmount: { required: false, number: true, range: [0, 9999999] }, FinalAmount: { required: true, number: true, range: [0, 9999999] } }, // Specify the validation error messages messages: { //Make: "Please enter asset make" }, submitHandler: function (form) { form.submit(); } }); 时,它总是无法验证。

我尝试了不同的格式,例如IE11,但它有效,但为什么它不适用于当前格式?

0 个答案:

没有答案