validate.js
validate.js copied to clipboard
Stop validation at first break
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
And if length invalid I don't want to check pattern validity.
Is such option exists or it should be added?
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
@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.
@ansman I am ready to take this in case it has chances to be merged.