Validation in type "Calendar"


 { type: "input", position: "absolute", label: "Revoke Date", name: "REVOKE_DT", maxLength: 20, validate: "ValidDate", labelWidth: 150, labelTop: 100, labelLeft: 10, inputWidth: 120, inputTop: 100, inputLeft: 170 },

The field is a date. The above code, I use “input” type then the validation is work.
Due to the field is a fate. I change the type to “calendar” but the validation is not work.

How about this problem ? The type “calendar” can work with validation ? How about your suggestion ?


 { type: "calendar", position: "absolute", label: "Revoke Date", name: "REVOKE_DT", maxLength: 20, validate: "ValidDate", labelWidth: 150, labelTop: 100, labelLeft: 10, inputWidth: 120, inputTop: 100, inputLeft: 170 },

Hi

valida date test value for string from “0000-00-00” to “9999-12-31”, in case of calendar value is a date Object, so you need validate: function(v){return (v instanceof Date && v.toString() != “Invalid Date”); }

If the date is from “00-00-0000” to “31-12-9999” .

Or the format is “00/00/0000” to “31/12/9999” .

How about the code different ?

here is current isValidDate

function(value) {
var d = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
return d && !!(d[1]<=9999 && d[2]<=12 && d[3]<=31) || false;
};

replace it according your needs

sorry maybe misunderstood your question

if you need to change date format in a form - there are params dateFormat and serverDateFormat
docs.dhtmlx.com/doku.php?id=dhtm … hxcalendar