Is it possible to remove or hide this standard lightning message?

I have overridden the new button with the aura component and used the record edit form and handling error In the controller, but I don't want to show this error to the user.

enter image description here

1 Answer 1


You need to remove the <lightning:messages /> from the lightning:recordEditForm to remove the standard lightning message. Use the onerror attribute to handle the error.



<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    <lightning:recordEditForm recordId="0035j00000MpvTxAAJ" objectApiName="Contact" onerror="{!c.handleError}">
        <lightning:messages />
        <lightning:outputField fieldName="AccountId" />
        <lightning:inputField fieldName="FirstName" />
        <lightning:inputField fieldName="LastName" />
        <lightning:inputField fieldName="Email" />
        <lightning:button class="slds-m-top_small" variant="brand" type="submit" name="update" label="Update" />


    handleError: function (component, event, helper) {
        //Get the error
        var error = event.getParams();
        console.log("Error : " + JSON.stringify(error));
        //Get the error message
        var errorMessage = event.getParam("message");
        console.log("Error Message : " + errorMessage);

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .