how write validations (vtypes) in separate js file
vtypes phone nos ,datefields , emails
thanq 2 have write separate file common validation
regards
custom vtypes can done few simple steps:
- apply custom object
ext.form.vtypes
- include file above in page
- use vtype other field
more specifically:
//seperate file, validation.js ext.apply(ext.form.vtypes, { your_v_type_nametext: "invalid!", //optional, message show when field invalid your_v_typemask: /.*/ //optional, regular expression characters cannot included your_v_type: function(value) { return false; //some expression evaluates true or false validate field } }); //your main file, main.html //other javasript <script type="text/javascript" src="validation.js"></script>
all need replace your_v_type
actual name of vtype, , when create field, set vtype
property vtype.
several validation types natively supported, if want create 1 phone numbers or email addresses, suggest using regular expression. there large library of these available regular expression library
Comments
Post a Comment