Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW - A flexible Validation module with async support #238

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arian
Copy link
Member

@arian 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

@anutron
Copy link
Member

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.

@timwienk
Copy link
Member

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.

@arian
Copy link
Member Author

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants