Form.datepicker initial value cannot pass the required validation


#1

On https://snippet.dhtmlx.com/pmz0zk16?text=form

Please replace the js code with below:

const form = new dhx.Form("form", {
  rows: [
    {
        type: "datepicker",
        label: "Date",
        value:new Date(),
        required: true,
    },
    {
        type: "button",
        text: "Send",
        submit: true,
    },
  ]
});

function validate() {
  document.querySelector("#validation-result").value = form.validate() ? "Valid form" : "Invalid form"
}

#2

Thank you for your report.
The problem is confirmed. We’ll try to fix it in one of the future updates.


#3

I think the issue is fixed in dhx suite 7.3.2. The initial date can pass the validation in my own app.
However, the issue in above snippet remains, despite of dhx suite pro 7.3.2.


#4

Please, try to define the value format for your DatePIcker control with the “valueFormat” parameter:
https://docs.dhtmlx.com/suite/form/api/calendar/api_calendar_properties/
Like:
https://snippet.dhtmlx.com/1t27zjk3


#5

It is working, thanks.