javascript - Extjs Form Validtion - Stack Overflow

I am using Extjs Ext.form.FormPanel to create a form that will contain some fields like name, pany,...,

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 badges
Add a ment  | 

2 Answers 2

Reset to default 4

ExtJS has vtypes, that let you write validation code.

Simpler: TextFields 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744863162a4597822.html

相关推荐

  • javascript - Extjs Form Validtion - Stack Overflow

    I am using Extjs Ext.form.FormPanel to create a form that will contain some fields like name, pany,...,

    1天前
    60

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信