Stop injecting field errors where they won't be used.

This commit is contained in:
Bryce Johnson 2016-10-17 11:44:25 +02:00
parent b5cee66612
commit 5f0b7fe429
1 changed files with 5 additions and 2 deletions

View File

@ -137,8 +137,11 @@
}
initValidators () {
// select all non-hidden inputs in form
this.state.inputs = this.form.find(':input:not([type=hidden])').toArray()
// register selectors here as needed
const validateSelectors = [':text', ':password', '[type=email]']
.map((selector) => `input${selector}`).join(',');
this.state.inputs = this.form.find(validateSelectors).toArray()
.filter((input) => !input.classList.contains(customValidationFlag))
.map((input) => new GlFieldError({ input, formErrors: this }));