ericelliott / h5Validate

An HTML5 form validation plugin for jQuery. Works on all major browsers, both new and old. Implements inline, realtime validation best practices (based on surveys and usability studies). Developed for production use in e-commerce. Currently in production with millions of users.
576 stars 125 forks source link

suggestion, stick to validation only #14

Closed jeroenhouben closed 13 years ago

jeroenhouben commented 13 years ago

Hi,

IMHO validation and showing/hiding errors, adding css classes etc are separate things. When combined in one library, you lose flexibility. I think it would be better to just do validation and offer callback functions to the developer implementing the library. That way he/she can define exactly what will happen when elements enter different validation states.

You can of course offer the functionality is it exists right now as seperate plugin.

Just my two cents!

ericelliott commented 13 years ago

Thanks for your comments. You make a valid point, however, h5Validate already supports the flexibility that you're asking for. You can override the markValid() and markInvalid() functions by passing replacements as configuration options. However, I'm planning to change the function signature, so you might want to wait for the next version.

I'm afraid I disagree that they should be separate libraries. Generally, you don't want one without the other, the defaults are good defaults (the messages and style come from your HTML/CSS -- nothing is hard-coded), and they're less than 1k, combined and minified.

jeroenhouben commented 13 years ago

That's cool, that's actually the thing I really wanted to be able to customize. Thanks for your reply!

ericelliott commented 13 years ago

No problem.