Revision history [back]

click to hide/show revision 1
initial version

answered 2021-04-14 19:27:50 +0800

Bobzk gravatar image Bobzk

Thanks for pointing me in the right direction.

Unfortunately I don't see it ever working unless the ZK SimpleConstraints.js is changed (either by Potix or my own version) as the option flag set by the JS is only the "g" flag. The SimpleConstraints JS simply ignores any supplied flag information (after the final "/") and uses a fixed "g" flag.

this._regex = new RegExp(k >= 0 ? cst.substring(j, k) : cst.substring(j), 'g');

Ideally Potix should accept a change request to support Regexp flags.

There is a possible alternative that does mostly what I want -

Use

inputAttributes="pattern=^[\p{L}\p{P}\p{Z}\p{N}\|]{1,32}$"

on the ZUL. You also need :

input:invalid { background-color: #ffdddd; }

in your CSS.

However as I need anyway to do further validation, I will do all validation at server and show error message as appropriate.

click to hide/show revision 2
Added link to modified Fiddle

Thanks for pointing me in the right direction.

Unfortunately I don't see it ever working unless the ZK SimpleConstraints.js is changed (either by Potix or my own version) as the option flag set by the JS is only the "g" flag. The SimpleConstraints JS simply ignores any supplied flag information (after the final "/") and uses a fixed "g" flag.

this._regex = new RegExp(k >= 0 ? cst.substring(j, k) : cst.substring(j), 'g');

Ideally Potix should accept a change request to support Regexp flags.

There is a possible alternative that does mostly what I want -

Use

inputAttributes="pattern=^[\p{L}\p{P}\p{Z}\p{N}\|]{1,32}$"

on the ZUL. You also need :

input:invalid { background-color: #ffdddd; }

in your CSS.

However as I need anyway to do further validation, I will do all validation at server and show error message as appropriate.

  • I have modified Fiddle to show this : Fiddle*
Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More