You need to sign in to do that
Don't have an account?
Error : component.find(...).get is not a function in lightning
Component
JS
<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");
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