Posted By

Piotrek290 on 03/18/10


Tagged

valid module 3 SoQ


Versions (?)

valid module for soq 3


 / Published in: JavaScript
 

  1. $.valid = {};
  2. $.valid.rules = { 'phone':/[0-9]{9}$/, 'phone2':/[0-9]{3}-[0-9]{3}-[0-9]{3}$/, 'email':/[\w\.\-]+\@([\w\-]+\.)+[a-zA-z]{2,4}$/, 'postcode':/[0-9]{2}-[0-9]{3}$/ };
  3. $.valid.addRule = function(a1,a2){ $.valid.rules[a1]=a2; };
  4. $.e.valid = function(a1){a3=$.valid.rules[a1.rule]||a1.rule;for(var y=0,Y=this.length;y<Y;y++){if((this[y].value).match(a3))$.func(a1.valid).call(this);else $.func(a1.notvalid).call(this);}return this;};

Report this snippet  

You need to login to post a comment.