Clearing date values on Form


#1

I’m seeing some issues with clearing date values on a Form. I have enabled editing on the DatePicker control so the value can be removed with Delete or Backspace. The first thing I noticed is that when the text is cleared and the field is exited (blurred), it does not fire the “change” event, either at the Form level or even on the DatePicker level.

I tried using the “input” event on the DatePicker to detect if the date text was removed and then clearing the control value.

form.getItem("ShipDate").events.on("input",function(inputValue){
    if (inputValue === ""){ form.getItem("ShipDate").clear(); }
    console.log(form.getItem("ShipDate").getValue());
    console.log(form.getValue());
});

The getValue on the control then shows an empty value, but the getValue on the form still returns the previously set date value. The “change” event for the form still doesn’t fire, either.

Currently I’m using this block of code when saving the form data to my server:

var vals = UI.Form.getValue();
vals.ShipDate = form.getItem("ShipDate").getValue();
vals.InvoiceDate = form.getItem("InvoiceDate").getValue();
vals.ReviewDate = form.getItem("ReviewDate").getValue();

Obviously that would keep getting more complicated with more date fields on the form.


#2

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


#3

Thank you for your report once again. Your problem was fixed in the latest (7.1.10) dhx.Suite update.