I want to trigger the "complete this field" message on a lightning:inputField if it is invalid (empty value). This works fine on a normal lightning:input, but is there a way to do it on an inputField? I was experimenting with showing/hiding a div with text in it under the inputField, but I'm not sure how to get the red outline on the component.

My current approach is:


<lightning:recordEditForm  objectApiName="CustomObject">
                                <lightning:inputField aura:id="customForm"
<div aura:id="customError" class="slds-text-body_regular slds-hide">Complete this field.</div>



if ( !( component.find( customForm ).get( "v.value" ) ) )
    component.find( customError ).getElement().classList.remove( "slds-hide" );
  • could you please share the code for your current approach? this way it will be easier to provide feedback, thanks!
    – glls
    Aug 9, 2018 at 15:33
  • Went ahead and added what I did
    – Franz
    Aug 9, 2018 at 15:46

1 Answer 1


Have you tried using tag inside ? If field is required (standard/custom validation), a message is displayed.

Otherwise you can also use slds styles to display your helptext by adding the following class : slds-form-element__help See this link for more information : https://www.lightningdesignsystem.com/components/input/ (tick "error" in 'states' section on the right hand side)

I hope this will help you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.