简体   繁体   English

p:inputMask-如何自定义掩码字符,例如强制输入以大写字母表示

[英]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.

相关问题 如何对 SQL 查询进行排序,但将某些 UTF-8 字符排序为正常等效字符? (例如É被视为E等) - How can I sort an SQL query but have certain UTF-8 characters be ordered as their normal equivalent? (e.g. É be regarded as E etc) 以密码格式屏蔽 textarea 中所有输入的文本,例如 ******** - mask all entered text in textarea in password format e.g. ******** IP 带有星号的掩码使用 jQuery - 例如 192.168.1.* - IP Mask with asterisks using jQuery - E.g. 192.168.1.* 禁止在所有输入文本框中使用jquery键入少量字符,例如“&lt;”,“&gt;” - Disallow typing of few of characters e.g.'<', '>' in all input textboxes using jquery 如何在LoopBack框架中禁用PersistedModel的某些HTTP方法(例如POST) - How to disable certain HTTP methods (e.g. POST) for PersistedModel in LoopBack framework json2html如何处理json键中的特殊字符(例如@) - json2html how to deal with special characters (e.g. @) in json keys 如何使用正则表达式获取特定字符后的所有字符,例如逗号(“,”) - How can I use regex to get all the characters after a specific character, e.g. comma (“,”) 如何在Javascript中打印罗马语(例如西班牙语)/特殊字符? - How do I print roman languages (e.g. Spanish) /special characters in Javascript? 将/和 - 字符后的每个字母大写 - Capitalize every letter after / and - characters 如何检查2位小数? 例如2.2.10 - how to check 2 decimals? E.g. 2.2.10
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM