Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upEasy to to get list of invalid form fields #16
Comments
bear
added
the
enhancement
label
Nov 6, 2014
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
cdaringe
Mar 25, 2015
Member
@scottcorgan, simple enough. You can extend with something like
invalidFields: function() {
return this._fieldViewsArray.filter(function(field) {
return !field.valid;
});
};will that work for ya?
|
@scottcorgan, simple enough. You can extend with something like invalidFields: function() {
return this._fieldViewsArray.filter(function(field) {
return !field.valid;
});
};will that work for ya? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
maddijoyce
Jul 22, 2015
I went a different way and changed the setValid function so validCallback gets a second parameter:
setValid: function (now, forceFire) {
var prev = this.valid;
this.valid = now;
if (prev !== now || forceFire) {
this.validCallback(now, _.mapValues(this._fieldViews, 'valid'));
}
},Now, my valid callback gets:
- A Boolean- Whether everything is valid or not.
- An Object- Keys are input names and values are valid or not, e.g.
{ 'firstName': true, 'lastName': false }
maddijoyce
commented
Jul 22, 2015
|
I went a different way and changed the setValid function so validCallback gets a second parameter: setValid: function (now, forceFire) {
var prev = this.valid;
this.valid = now;
if (prev !== now || forceFire) {
this.validCallback(now, _.mapValues(this._fieldViews, 'valid'));
}
},Now, my valid callback gets:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
scottcorgan commentedNov 5, 2014
Ran into an issue recently with an invalid form field preventing the form from submitting. Right now an invalid class is added to an element, but it would be nice to have a method on the class to get a list of invalid form fields.