Comma character in a error message constraint

asked 2011-12-30 10:48:01 +0800

adiazmarti gravatar image adiazmarti


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.

delete flag offensive retag edit

1 Reply

Sort by » oldest newest

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

vincentjian gravatar image vincentjian
2245 6

updated 2012-01-02 03:33:31 +0800


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>

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2011-12-30 10:48:01 +0800

Seen: 411 times

Last updated: Jan 02 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More