add validate
rewrite from jquery.validate.js