Reputation: 3
Getting TypeError: Action failed: [component.find(...).filter is not a function] in below code
isFormValid: function (component) {
return (component.find('requiredField'))
.filter(function (i) {
var value = i.get('v.value');
console.log('Emailissue' + value);
return !value || value == '' || value.trim().length === 0;
})
.map(function (i) {
return i.get('v.fieldName');
});
},
Upvotes: 0
Views: 715
Reputation: 19637
Do you display the field(s) conditionally? Wrapper in <aura:if isTrue=...>
tag maybe?
Your find
returned a single record with that aura:id
(so there's no "filter" on it, it's a single object, not an array) or it haven't found anything at all.
Go to setup -> debug mode, enable it for yourself and add debugger;
to this code (or add a watch/breakpoint from the browser's F12 console)
Upvotes: 0