You need to sign in to do that
Don't have an account?
Mark Moser 10
how do i use component.find for an aura:id in an aura:iteration and then inside an aura:if
Component:
<aura:iteration items="{!v.fields}" var="f">
<aura:if
isTrue="{!((v.recordId==null&&f.fieldPath=='genesis__Business_Name__c'))}"
>
<aura:if
isTrue="{!and(not(v.newAccount), empty(v.tradeUpDetails))}"
>
<lightning:inputField
fieldName="genesis__Account__c"
aura:id="inputFieldAccountName"
class="input-is-required"
onchange="{!c.lookupChange}"
value="{!v.accountId}"
autocomplete="nope"
/>
<aura:set attribute="else">
<lightning:inputField
fieldName="genesis__Business_Name__c"
aura:id="inputFieldAccountId"
class="input-is-required"
autocomplete="nope2"
/>
</aura:set>
</aura:if>
</aura:if>
<aura:if
Helper:
var inputAccountName = component.find("inputFieldAccountName");
console.log(inputAccountName.get("v.value"));
gets exception on var input account name but just stops running at that point
<aura:iteration items="{!v.fields}" var="f">
<aura:if
isTrue="{!((v.recordId==null&&f.fieldPath=='genesis__Business_Name__c'))}"
>
<aura:if
isTrue="{!and(not(v.newAccount), empty(v.tradeUpDetails))}"
>
<lightning:inputField
fieldName="genesis__Account__c"
aura:id="inputFieldAccountName"
class="input-is-required"
onchange="{!c.lookupChange}"
value="{!v.accountId}"
autocomplete="nope"
/>
<aura:set attribute="else">
<lightning:inputField
fieldName="genesis__Business_Name__c"
aura:id="inputFieldAccountId"
class="input-is-required"
autocomplete="nope2"
/>
</aura:set>
</aura:if>
</aura:if>
<aura:if
Helper:
var inputAccountName = component.find("inputFieldAccountName");
console.log(inputAccountName.get("v.value"));
gets exception on var input account name but just stops running at that point
You may need to loop the array to get the value.