-
Bug
-
Resolution: Fixed
-
Major
-
7.0.0
-
None
-
Security Level: Jimmy
-
None
Reproduce:
Use the code below:
<zk> <datebox id="db" cols="20" format="yyyy/MM/dd a hh:mm:ss" onCreate="self.value = new Date()" /> </zk>
1. Open calendar of datebox
2. Click hour of inner timebox
3. Click up arrow of inner timebox to change hour
4. Press Enter key
then the hour changed back to old value.
Cause:
this line https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/db/Datebox.js#L396
this._pop.doKeyDown_(evt);
triggered clickDate and rever the value before
this.enterPressed_(evt);
Workaround:
Restore value manually as below:
<zk xmlns:w="client"> <datebox id="db" cols="20" format="yyyy/MM/dd a hh:mm:ss" onCreate="self.value = new Date()"> <attribute w:name="_doKeyDown"><![CDATA[ function (evt) { if (evt.keyCode == 13 && evt.target == this._tm) // Enter from inner timebox var _tmpValue = this.getInputNode().value; this.$_doKeyDown(evt); if (_tmpValue) this.getInputNode().value = _tmpValue; } ]]></attribute> </datebox> </zk>
- relates to
-
ZK-2201 The manual time change has no effect in a datebox when it is executed with the enter button
- Closed