NEW - A flexible Validation module with async support #238

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants
Owner

arian commented Apr 24, 2011

Like you might know, I started a while ago writing a validation class, but now I'd like to make a pull request to get some more feedback + maybe an approve eventually.

Features include:

  • Adding multiple rules
  • Return an object with failed rules and some useful properties
  • Async support, so you could write a rule/validator which makes a Request
  • A fast Validation.validate shortcut
  • Some default validators

This is part 1 of all the stuff I've been working on, but this is the base class for now which is hopefully easier to review than everything in one time. The whole branch can be found here: https://github.com/arian/mootools-more/tree/validation or https://github.com/arian/mootools-more/compare/validation

Other features are:

  • Localized support (including localized rules)
  • A JSON Scheme validator
  • Even more Validators

TODOs

  • Write docs for them (when we've agreed on the API)
  • Do pull requests for the other parts
  • Integrate with Form.Validator
Owner

anutron commented Jun 5, 2011

Just getting to this (sorry, life happens). I like the abstraction. The intention here is to yank out some of this stuff from FormValidator and have it power that class? If so, I like.

Owner

timwienk commented Jun 5, 2011

The idea is to have an abstract Validation class, which is useable in any environment. The Form.Validator is then supposed to be just an implementation of Validation aimed at form elements. That way you'd be able to use the same Validation Class and rules in the browser and on the server-side.

Owner

arian commented Jun 5, 2011

That's the idea indeed, to have a bit lower level validation class which can be used in various cases and environments. Probably we need to write some specs for Form.Validator to make sure it won't break when using this in it. But like I said, I have some more stuff for this validator, and we could start with this pull request and add Form.Request and other stuff later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment