-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi
I hava a problem with this code:
<datebox id="fecha" constraint="no empty: Por favor, indique una fecha válida, before 20111231: No se permiten operaciones efectuadas después del 31/12/2011"/>
The error message for the no empty constraint has a comma character, so the second constriant doesn't work. Is ther a way to escape that comma character.
Hi,
The "before" constraint will not work even if there is no comma character because constraint do not support multiple custom error message currently.
I have post a feature request here.
In the mean time, you could use the following workaround:
<script type="text/javascript"><![CDATA[ zk.afterLoad('zul.inp', function () { var oldValidate = zul.inp.SimpleConstraint.prototype.validate; zk.override(zul.inp.SimpleConstraint.prototype, {}, { validate: function (wgt, val) { var v = oldValidate.apply(this, arguments); var f = this._flags; if (f.NO_EMPTY && (!val || !val.trim())) return 'Por favor, indique una fecha válida'; return v; } }); zk.override(zul.inp.SimpleDateConstraint.prototype, {}, { outOfRangeValue: function () { return 'No se permiten operaciones efectuadas después del 31/12/2011'; } }); }); ]]></script> <datebox id="fecha" constraint="no empty, before 20111231"></datebox>
Asked: 2011-12-30 10:48:01 +0800
Seen: 411 times
Last updated: Jan 02 '12