It is not possible to clear an editable field of type "datepiker" in a dhx.Form 6.4.2


#1

There is a form:

let form = dhx.Form('formCont', {rows: [
    {id:'date_reg', type:'datepicker', required:true, label:'Registration date', width:'600px', labelWidth:'180px', labelPosition:'left', weekStart:'monday', dateFormat:'%d.%m.%Y', value:new Date()},
    {id:'date_exp', type:'datepicker', label:'Expiration date', editable:true, width:'600px', labelWidth:'180px', labelPosition:'left', weekStart:'monday', dateFormat:'%d.%m.%Y'}
]});

The second field may be empty. But if I once set a value for it, it is impossible to remove this value: the input field will be empty, but form.getValue () will return:

{“date_reg”:“24.04.2020”, “date_exp”:“24.04.2020”}

Calendar.setValue() method does not accept a null value, Calendar.clear() method does not fire a ‘change’ event. For now I use this workaround:

let id = 'date_exp';
document.querySelector('input#' + id).onchange = function(Ev) {
	if(this.value!=form.getValue()[id]) {
		form.getItem(id).getWidget().clear();
		this.value = form.getItem(id).config.value = form._state[id] = '';
    }
}

It would be great if in the next version you provided normal processing of such fields. Thanks!

P.S. Do you reply to messages in Russian?


#2

Thank you for your report.
The problem is confirmed, and we’ll try to fix it in the future updates.

Do you reply to messages in Russian?

Yes, I can reply in Russian, but this forum is public, and your posted problem may also happen to any other user, and it will be better if he could find the answer in the already created topic.


#3

Thank you for your reply and your work!


#4

The problem is not fixed in Suite 6.4.3


#5

Unfortunately we were not able to fix that prtoblem in this update, but we’ll fix it in one of the next updates.


#6

The problem was finally fixed in the dhtmlxForm 6.4.4


#7

@sematik
Thank you for your information. Unfortunately, I can’t switch to Suite 6.4.4 in my project right now due to many CSS issues that I find in this version :frowning: . And I can’t test changes in your snippet’s tool too, cause there is still 6.4.3 library version in the tool (as of May 22, 2020). Please set actual version in your tool.

Thanks


#8

This issue is fixed in Suite 6.4.4
https://snippet.dhtmlx.com/17xqa7pg


#9

@sematik
Please, change version of suite.css file in snippet tool to 6.4.4 too. I can’t show you my CSS issues in this version.


#10

Could you please clarify your problem, as the css should be correct in the snippet tool.


#11

@sematik
Now everything is correct in snippet tool. Maybe my Firefox cache js and css files too long. Anyway, thanks!!!

I described my CSS issues here.