admin管理员组文章数量:1404927
I am using Extjs Ext.form.FormPanel to create a form that will contain some fields like name, pany,...,etc. Among the fields will be zip code and phone number, let's take the zip code problem, the zip code could be 5 numbers or 5 numbers plus 4 characters, I don't want to create two separate fields for the zip code, is there a way that I could create one field and prevent users from entering the zip code wrongly, just as the following jQuery plugin does:
/
I am using Extjs Ext.form.FormPanel to create a form that will contain some fields like name, pany,...,etc. Among the fields will be zip code and phone number, let's take the zip code problem, the zip code could be 5 numbers or 5 numbers plus 4 characters, I don't want to create two separate fields for the zip code, is there a way that I could create one field and prevent users from entering the zip code wrongly, just as the following jQuery plugin does:
http://digitalbush./projects/masked-input-plugin/
Share asked Jun 18, 2009 at 20:15 AhmadAhmad 2251 gold badge3 silver badges9 bronze badges2 Answers
Reset to default 4ExtJS has vtypes, that let you write validation code.
Simpler: TextField
s have a regex
configuration option that forces match on validation.
Your regex can be (assuming space separator then a-z only, case-insensitive):
/^\d{5}(? [a-z]{4})?$/i
If your intent is to accept ZIP or ZIP+4, the regex format should be as follows:
/^\d{5}(?-\d{4})?$
The optional delimiter should be a dash, and the four "characters" should always be numbers.
本文标签: javascriptExtjs Form ValidtionStack Overflow
版权声明:本文标题:javascript - Extjs Form Validtion - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744863162a2629190.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论