Revision history [back]

click to hide/show revision 1
initial version

answered 2012-01-02 03:32:42 +0800

vincentjian gravatar image vincentjian


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';
<datebox id="fecha" constraint="no empty, before 20111231"></datebox>
Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More