I have a custom lightning component to create Contact record.
<lightning:recordEditForm objectApiName="Contact">
<lightning:messages />
<lightning:inputField fieldName="FirstName" />
<lightning:inputField fieldName="LastName" />
<lightning:inputField aura:id="account-field"
fieldName="AccountId"
value="{! v.accountId }" />
<lightning:button type="submit" label="Create Contact" />
</lightning:recordEditForm>
AccountId
field is known upfront, how I can prevent users from editing it?
Best Answer
Use
ui:outputText
to show the account Id it cannot be edited.