Extjs Form Tolerance

I use Extjs Ext.form.FormPanel to create a form that will contain some fields, such as name, company, ... etc. Among the fields there will be a zip code and a phone number, let the problem with the zip code, the zip code can be 5 numbers or 5 numbers plus 4 characters, I do not want to create two separate fields for the zip code, is there a way I could create one field and prevent users from entering the zip code by mistake, as the following jQuery plugin does:

http://digitalbush.com/projects/masked-input-plugin/

+3
source share
2 answers

ExtJS has vtypes that allows you to write verification code.

: TextField regex, . ( , a-z , ):

/^\d{5}(? [a-z]{4})?$/i
+4

ZIP ZIP + 4, :

/^\d{5}(?-\d{4})?$

, "" .

+1

Source: https://habr.com/ru/post/1710801/


All Articles