thedersen/backbone.validation — Issue #33: validateAll issue
Author: area51mafia
Created: 2012-03-09 08:33:06+00:00
State: open

Hi. I seem to be having an issue with validators being called multiple times. From what I see from the code, validateObject is called and it loops over all the post-set attributes of the model and determines if any are incorrect. This makes sense to me, and returns expected results. Then, however, if that pass turns out to be valid, validateObject calls validateAll which loops over just the attributes that have validators.
```javascript
if (isValid) {
isValid = validateAll(model, validation, attrs, computed, view, options);
}
```
My issue arises in this call to validateAll if the compute values are all correct. It calls validateAttr, but using the model.get value of the attribute (which returns the old value).
```javascript
error = validateAttr(model, validation, validatedAttr, model.get(validatedAttr), computed);
```
So, it calls the validators on your new value, and then again on the OLD value if the new value is valid? I don't really understand this behavior or is it a bug and I'm driving myself nuts trying to wrap my head around how it should work?