I am using Extjs Ext.form.FormPanel to create a form that will contain some fields like name, company,...,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.com/projects/masked-input-plugin/
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 you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With