-
Bug
-
Resolution: Won't Fix
-
Normal
-
8.6.2
-
Security Level: Jimmy
-
ZK 9.5.0 S1
-
None
Steps to Reproduce
run fiddle
http://zkfiddle.org/sample/38pbkqf/1-on-error-fires-again-with-good-value
enter "-1" (invalid) > get error, send on error
enter "1" (valid)
Current Result
clear error, send on error, send on change
Expected Result
clear error, send on change
Debug Information
https://github.com/zkoss/zk/blob/v9.1.0/zul/src/archive/web/js/zul/inp/InputWidget.js#L680
em stores the error message
https://github.com/zkoss/zk/blob/v9.1.0/zul/src/archive/web/js/zul/inp/InputWidget.js#L692-L693
error message fired to server, even on correct value
Workaround
<script><![CDATA[ zk.afterLoad("zul.inp", function () { var _xInputWidget = {}; zk.override(zul.inp.InputWidget.prototype, _xInputWidget, { _validate: function (value) { zul.inp.validating = true; try { var val = value, msg; if (typeof val == 'string' || val == null) { val = this.coerceFromString_(val); if (val && ((msg = val.error) || val.server)) { this.clearErrorMessage(true); if (val.server || this._cst == '[c') { //CustomConstraint this._reVald = false; return {rawValue: value || '', server: true}; //let server to validate it } this._markError(msg, val); return val; } } //unlike server, validation occurs only if attached if (!this.desktop) this._errmsg = null; else { var em = this._errmsg; this.clearErrorMessage(true); msg = this.validate_(val); if (msg === false) { this._reVald = false; return {value: val, server: true}; //let server to validate it } if (msg) { this._markError(msg, val); return {error: msg}; } this._reVald = false; if (em){ console.log('prevented onError: ' + val); //this.fire('onError', {value: val}); } } return {value: val}; } finally { zul.inp.validating = false; } } }); }); ]]></script>
- relates to
-
ZK-197 The datebox shall fire onError after the error is cleared.
- Closed