Setting and validating date formats

Hello,

I’ve been trialling the DHTMLX product suite for a few days now, and am generally very impressed by it so far.

However, I’ve run across one small problem, which I hope you might help me solve.

I’ve created a dhtmlxForm which includes a popup dhtmlxCalendar wired to an input field.

Everything works correctly, except that the input field’s isValidDate method considers the calendar’s date format of mm-dd-yyyy to be invalid. A date format of yyyy-mm-dd, however, is successfully validated.

The input field is defined within the form as:

	type: "input",
	name: "Target Date",
	label: "Target Date (mm-dd-yyyy)",
	value: "",
	width: "100",
	validate: "custom_targetDate"

The input field’s validation function is:

 function custom_targetDate(value) {
	if (!dhtmlxValidation.isValidDate(value)) 
        return "A valid date must be entered";
        return true;

And finally, the calendar is instantiated and wired to the input field thusly:

    dhtmlXForm.prototype.items.input.showCalendar = function(item) {
        var inp = item.childNodes[0].childNodes[1].childNodes[0];
        inp.onclick = function(e){
           e = e||event;
           e.cancelBubble = true;
           e.returnValue = false;
           if (!myCalendar) {
              myCalendar = new dhtmlXCalendarObject(this, true);
              myCalendar.setDateFormat("%m-%d-%Y");
              myCalendar.show();
           }
           return false;
        };
     };
        myForm.doWithItem("Target Date", "showCalendar");

Thank you very much for any assistance you might offer.

Unfortuantely we cannot reproduce this issue locally. Can you please open ticket at support.dhtmlx.com/ and provide us complete demo where the issue can be reconstructed.

Greetings, Olga,

Since I am evaluating the ‘standard’ version, I have no licence number and therefore cannot log into the site to create a ticket as you have asked. Perhaps you might provide me some sample initialisation code, showing a form field with a date format of mm-dd-yyyy, and the related validation code for it, please?

Based on the documentation, I can’t see what I’m doing wrong. Thank you.