With new Summer '18 release following code returns empty list:

component.find("social-security-number-form").find({instancesOf : "lightning:input"})

"social-security-number-form" is an aura:id of components div wrapper. In Spring '18 this line returned a list of all inputs that I have in my form and also it works just fine if I replace lightning:input with ui:input.

Does anybody know why this approach is not working for lightning: components in new release?

  • we had multiple issues with lightning:input in our project. we have created tickets with salesforce support. but its a beta component so you may not get the desired response. – RedDevil May 18 '18 at 14:23

I was going through some old unanswered questions and stumbled upon this. I am currently on Summer'18 and below worked for me. Perhaps it has been fixed? If not, are you able to provide steps to replicate this issue?


<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes">

    <div aura:id="myDiv">
        <lightning:input aura:id="input1" name="input1" value="Input 1"/>
        <lightning:input aura:id="input2" name="input2" value="Input 2"/>
        <lightning:badge label="Some Random Badge"/>
        <lightning:input aura:id="input3" name="input3" value="Input 3"/>
        <lightning:input aura:id="input4" name="input4" value="Input 4"/>
        <lightning:formattedDateTime value="1479944705000"/>
    <lightning:button label="Find All Inputs" onclick="{!c.findAllLightningInputs}"/>


Controller JS

    findAllLightningInputs: function(component, event, helper) {
        var myInputs = component.find("myDiv").find({instancesOf : "lightning:input"});
        alert('There are ' + myInputs.length + ' lightning:input elements within myDiv.');
        for(var i = 0; i < myInputs.length; i++)
            console.log('------> aura element in array value @ index ' + i + ' = ' + myInputs[i].get("v.value"));
  • 1
    If my wrapper is lightning:recordEditForm instead of div, what would be the solution? – Thamilhan Aug 21 '19 at 13:39
  • @Thamilan I ended up not using recordEditForm since that in conjunction with lightning:inputFields massively restricts our ability to validate on the fly. By using lightning:inputs we can use the method described in this article (reduce then showHelpMessageIfInvalid) to validate when we need to developer.salesforce.com/docs/atlas.en-us.lightning.meta/… – ministe2003 Jan 29 '20 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.