segmentio / validate-form

Easily validate a form element against a set of rules.
43 stars 6 forks source link

Equal Validator #11

Closed dominicbarnes closed 10 years ago

dominicbarnes commented 10 years ago

I've added an "equal" validator, which basically validates that a field has the same value as another field. (like "confirm email" or "confirm password") I've added docs and a test as well.

The biggest change was that I allowed Field to accept the parent Validator as a param. I was wanting to get a reference to Validator#form so I didn't need to use closest to traverse up and back down. It made sense to just pass 1 argument and extrapolate from there.

Also updated the history to be a bit more accurate.

Lastly, there is 1 failing test, but it looks like it is for a feature that was never coded? (async validators, that is)

ianstormtaylor commented 10 years ago

sorry for the delay here