ansman / validate.js

A declarative validation library written javascript
https://validatejs.org
MIT License
2.63k stars 337 forks source link

Stop validation at first break #274

Open baidario opened 6 years ago

baidario commented 6 years ago

When a field has a few rules, library check all rules even if first failed. For example, password has 2 rules: length and pattern validation image And if length invalid I don't want to check pattern validity. Is such option exists or it should be added?

eleow commented 6 years ago

Similarly, if it fails "presence", there is no point in checking for any others. Current workaround that I see is that you just print the first error in the array that is returned

bohdan-shulha commented 5 years ago

@eleow , sometimes it is not enough though. :(

My case includes an async validation (checking for uniqueness of an email address) and even if I could display only the first error - I still have a round-trip query.

bohdan-shulha commented 5 years ago

@ansman I am ready to take this in case it has chances to be merged.