function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shravan Kumar 71Shravan Kumar 71 

Error : component.find(...).get is not a function in lightning

Component
<aura:if isTrue="{!v.leadRecord.Company!=null}">
            <div class="slds-form-element">
                <label class="slds-form-element__label" for="text-input-id-1">Company</label>
                <div class="slds-form-element__control">
                    <input type="text" aura:id="company" placeholder="" value="{!v.leadRecord.Company}" disabled="true" class="slds-input" />
                </div>
            </div>
            <aura:set attribute="else">
                <lightning:input aura:id="company" label="Company Name" required="true" value="{!v.company}"/>
            </aura:set>
        </aura:if>

JS
var company = component.find("company").get("v.value");

 
lnallurilnalluri
@Shravan, I suggest you should use lightning:input when you want to work with aura:id. Below should work.
 
<lightning:input type="text" aura:id="company" placeholder="" value="{!v.leadRecord.Company}" disabled="true" class="slds-input" />

 
Shravan Kumar 71Shravan Kumar 71
@lnalluri : Sorry, that didn't work out. Still have the same error message. 

 Let me brief it out what I am looking at here : A Lead may or may not have value in the Company field. If the value is present then the field on the component should be readonly in the component and the current value should be passed to the JS. If the field value is not present then the user will enter the value manually and the value should be passed to the JS. In both these case, I need to get the value and pass it to my Apex Controller for further processing