Adding an ExtJS VType of EmailList


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. if (Ext && Ext.form.VTypes) {
  2. var email = /^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,4}$/;
  3. Ext.apply(Ext.form.VTypes, {
  4. EmailList: function(val) {
  5. var addrs = val.split(',');
  6. var idx = Ext.each(addrs, function(item) {
  7. return email.test(item.trim());
  8. });
  9.  
  10. return !Ext.type(idx);
  11. },
  12. EmailListText: 'Not a valid email address or comma separated list of email addresses.'
  13. });
  14. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.