-
Bug
-
Resolution: Fixed
-
Normal
-
8.6.2
-
Security Level: Jimmy
-
None
Steps to Reproduce
<zk> <datebox id="db" format="MM/dd/yyyy" constraint="no empty" onCreate="self.setValue(new Date());" onChange=""/> <datebox id="dbConstraint" format="MM/dd/yyyy" constraint="between 21000101 and 19000101" onCreate="self.setValue(new Date());" onChange=""/> </zk>
focus either Datebox without changing the value
leave(blur) Datebox again
Current Result
an onChange event with the initial unchanged value is sent to the server
Expected Result
only send onChange when the value was changed
Debug Information
the constraint sets a flag this._reVald which triggers the revalidation failing to recognize the value is still unchanged
ZK-658
tomyeh added a comment - 13/Dec/11 4:46 PM
Notice if the constraint property is also specified, onChange is always fired.
Reason: [spec] if constraint is specified, the first onblur will cause the input to re-validate.
https://sourceforge.net/p/zk1/bugs/838/
In this fix, the event will be consumed and onChange won't be called.
Workaround
suppress update/validation logic for unchanged input value
zk.afterLoad('zul.db', function() { var xDatebox = {}; zk.override(zul.db.Datebox.prototype, xDatebox, { updateChange_ : function() { if(this.getInputNode().value === this._defRawVal) { return false; } return xDatebox.updateChange_.apply(this, arguments); } });//zk.override });//zk.afterLoad