Form datepicker validation problem

Hi, I’m stydying the form component of suite 8 gpl and blocked during the use of datepicker.
The goal was to validate the choosen date with the year of the previous control. I used this code:
(the form will be attached to window later)

	form_t = new dhx.Form(null, {
		width: 500,
		height: 630,
		rows: [
			{
				id: "anno_verb",
				type: "input",
				label: "Anno Verbale",
				inputType: "number",
				placeholder: "Anno",
				required: true,
				min: 2016,
				validation: function(value) {
					return value <= 2100 && value > 2015
				}
			},
			{
				id: "data_verb",
				type: "datepicker",
				label: "Data Verbale",
				placeholder: "dd/mm/yyyy",
				dateFormat: "%d/%m/%Y",
				weekStart: "monday",
				required: true,
				validation: function(value) {
					year = form_t.getItem("anno_verb").getValue();
					Vyear = value.split("/");
					return parseInt(Vyear[2]) == year;
				},
			},
			{
				type: "spacer"
			},
			{
				align: "between",
				cols: [
					{
						type: "spacer",
					},
					{
						type: "button",
						text: "ANNULLA",
						view: "link",
						color: "primary",
						size: "small",
						css: "dhx_form-button",
						id: "cancel"
					},
					{
						type: "button",
						text: "AGGIUNGI",
						view: "flat",
						color: "primary",
						size: "small",
						css: "dhx_form-button",
						id: "addItem"
					}
				]
			}
		]
	});

	form_t.events.on("afterValidate", function (id, value, isValid) {
		if (!isValid) {
			dhx.alert(...);
		}
	});

Now, the validation rule on datepicker never activates.
I tried to paste the code in an example snippet and the result was the same.
I also forced → “return false;” in the function block.
Can you help me, please?

I think i can confirm the problem and it is easy to reproduce but only using release 8.3.7. The same code works as expected in 8.2.7
https://snippet.dhtmlx.com/retclb4q

Workarouns? Waiting for next release?

Temporary workaround:

var frmVal;

	form_t.events.on("beforeChange", function (id, value) {
		if( id == "data_verb" ) {
			frmVal = true;
			year = form_t.getItem("anno_verb").getValue();
			Vyear = value.split("/");
			if( parseInt(Vyear[2]) != parseInt(year) ) {
				dhx.alert({text: "Not valid! (anno verb.: "+year+")",buttonsAlignment: "center",buttons: ["OK"]});
				frmVal = false;
			}
		}
		return true;
	})

	form_t.events.on("change", function (id, value) {
		if( id == "data_verb" ) {
			 if( frmVal == false ) {
			 	form_t.getItem(id).clear();
			 	return false;
			 }
		}
		return true;
	})

I’d probably just use 8.2.7 instead of working around :smiley:

Thank you for your report. The problem was confirmed.
We’ll try to fix it in one of the future updates.
I’ll inform you about any progress on this issue.

We fixed your reported problem in the latest dhx.Suite update (v8.3.9).
Now the validation for the datePicker control works correctly.

Please, download the latest available dhx.Suite build from your client’s area to get this fix.
Thank you for your report.