Skip to content
This repository has been archived by the owner on Dec 25, 2017. It is now read-only.

Validation is called for all fields in form every time #179

Closed
pavgra opened this issue Mar 28, 2016 · 1 comment
Closed

Validation is called for all fields in form every time #179

pavgra opened this issue Mar 28, 2016 · 1 comment
Labels

Comments

@pavgra
Copy link

pavgra commented Mar 28, 2016

I am confused whether it is OK that validation is called for all fields every time I change something in a form. Check the fiddle and try to change only 'First name' field. Every time you change it, the 'Second name' field is validated too. Is it OK? For both logic and performance reasons.

Probably this happens because of that in this function

BaseValidation.prototype.handleValidate = function handleValidate(el, type) {
      this.willUpdateTouched(el, type);
      this.willUpdateDirty(el);
      this.willUpdateModified(el);

      this._validator.validate(this.field);
};

param passed to this._validator.validate is this.field but not {field: this.field}

@kazupon kazupon added the bug label Mar 28, 2016
@blocka
Copy link

blocka commented Mar 31, 2016

What happens if you have a field A that depends on the value of B? If field B gets updated, I would want the validation to rerun on field A.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants