[英]p:inputMask - how to customize the mask characters e.g. force input to capitalize certain letter
I would like to force input to capitalize a letter in certain position of text using p:inputMask. 我想使用p:inputMask强制输入在文本的特定位置将字母大写。 In jquery-plugins.js one can find following definition:
a: "[A-Za-z]"
. 在jquery-plugins.js中,可以找到以下定义:
a: "[A-Za-z]"
。 My goal is to get something like: a: "[az]", A: "[AZ]"
. 我的目标是得到类似:
a: "[az]", A: "[AZ]"
。 Is it possible to get this without big and maybe harmful changes in PrimeFaces source code? 是否可以在PrimeFaces源代码中不做大的,可能有害的更改而获得此功能?
If the existing definitions (a, 9,*) are not sufficient, you can add your own ones. 如果现有定义(a,9,*)不足,则可以添加自己的定义。 You can change it to anything you like by using regular expressions by putting this in your page:
您可以通过在页面中使用正则表达式将其更改为所需的任何内容:
$.mask.definitions['*']= "[\\S]"
This eg meaning any non-whitespace character, so #, % etc are allowed to; 例如,这意味着任何非空格字符,因此允许#,%等;
$.mask.definitions['A']= "[A-Z]"
$.mask.definitions['a']= "[a-z]"
Make 'a' require lowercase and 'A' uppercase 使“ a”要求小写,而“ A”要求大写
See also 也可以看看
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.