Skip to content

Comment on Show HN: validate.js - lightweight JavaScript form validation library

Comments

I think you should have params to the validators, specifically for the regex case, in which the callback_ approach, with registration and such, is quite onerous.

  {
      rules: 'regex',
      params: {
          regex: [/abc/]
      }
  }
or,
  {
      rules: 'regex:^foo'
  }

I like this idea a lot. I chose to start out with the callback_ approach due to trying to mimic the CodeIgniter API. However, this would be much easier especially for just a regex.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.