You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.
I'm using ui-select for dropdowns and valdr required field validation works like a charm for single select. However, it does not work for multiselect dropdowns.
I figured out the problem was due to valdrUtil.notEmpty method. Here it is checking if the value is undefined, empty string or null value. For a multiselect dropdown, it will be an empty array.
So we can fix this by adding a check to see if the value is an array and if yes, check its length property. If its 0, it means its an empty array and hence should return false.
notEmpty: function (value) {
if (this.isNaN(value)) {
return false;
}
if (angular.isArray(value) && value.length === 0){
return false;
}
return angular.isDefined(value) && value !== '' && value !== null;
}
Is this something that can be included in the next release?
The text was updated successfully, but these errors were encountered:
I'm using ui-select for dropdowns and valdr required field validation works like a charm for single select. However, it does not work for multiselect dropdowns.
I figured out the problem was due to valdrUtil.notEmpty method. Here it is checking if the value is undefined, empty string or null value. For a multiselect dropdown, it will be an empty array.
So we can fix this by adding a check to see if the value is an array and if yes, check its length property. If its 0, it means its an empty array and hence should return false.
Is this something that can be included in the next release?
The text was updated successfully, but these errors were encountered: