I would like to know if it's possible to evaluate the expression from the RecordEditForm.
This component's "else" is never hit. Are aura if tags supported within RecordEditForms?
Comments__c is a Text field.
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId">
<aura:attribute name="anyAccount" type="String" access="public"/>
<lightning:card class="slds-text-heading_small slds-card_boundary" title="{!'Account Type : ' + v.anyAccount }" >
<lightning:recordEditForm recordId="{!v.recordId}"
aura:id="editRecord"
objectApiName="Account"
>
<!-- onsubmit belongs to the button within the form -->
<center><strong><lightning:outputField fieldName="Name" /></strong></center>
<lightning:inputField fieldName="Industry" />
<lightning:outputField fieldName="Industry" />
<aura:if isTrue="{!empty(v.Comments__c)}">
<lightning:inputField fieldName="Send_To_ERP__c" />
<aura:set attribute="else">
This Account is in ERP
</aura:set>
</aura:if>
</lightning:recordEditForm>
<center><lightning:button class="slds-m-top_small" variant="brand" type="submit" name="update" label="Update Account" onclick="{!c.update}" /></center>
</lightning:card>
</aura:component>
You should see different outcomes
aura:attribute
and to reference it usingv.
. But I'm unsure what the best pattern is. See e.g. salesforce.stackexchange.com/questions/254667/… and the comment "Just set the attribute on onload of the record edit form and it will work" which sounds like a good way to go.