function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
David M. ReedDavid M. Reed 

Lightning Data Service Trailhead - pass conditions broken?

I am struggling to pass the final unit of this module, "Handle Record Changes and Errors". The error message I'm stuck on is "The 'accEdit' Lightning Component does not appear to be displaying the 'recordSaveError' value inside a div with the class 'recordError'."

I am displaying the error as described, and I've copied and pasted various solutions posted here and on StackExchange several months ago, but it appears the validation checks have changed as none of these things work. Below is my current `accEdit.cmp` - as you can see, I'm trying a variety of display approaches and can't get any of them to pass. 

Any hints would be welcomed!

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    <aura:attribute name="accountRecord" type="Account" />
    <aura:attribute name="simpleAccountRecord" type="Account" />
    <aura:attribute name="recordSaveError" type="String" default="" />
    
    <force:recordData targetRecord="{ v.accountRecord }"
                      targetFields="{! v.simpleAccountRecord }"
                      recordId="{! v.recordId }"
                      mode="EDIT"
                      fields="Name"
                      aura:id="record"
                      targetError="recordSaveError"/>
    
    <lightning:card title="Edit Account">
        <aura:if isTrue="{! v.recordSaveError }">
            <div class="recordSaveError">
                {! v.recordSaveError }
                Error: <ui:outputText value="{! v.recordSaveError }"/>
                Error: <lightning:formattedText value="{! v.recordSaveError }"/>
                <ui:message title="Error" severity="error" closable="true">
                    {!v.recordSaveError}
                </ui:message>
            </div>
        </aura:if>

        <lightning:input value="{! v.simpleAccountRecord.Name }" label="Account Name" />
        <lightning:button label="Save Account" onclick="{! c.handleSaveRecord }" />
    </lightning:card>
</aura:component>

 
Best Answer chosen by David M. Reed
Alain CabonAlain Cabon
Hi,

 <div class="recordSaveError">

"The 'accEdit' Lightning Component does not appear to be displaying the 'recordSaveError' value inside a div with the class 'recordError'."

recordError != recordSaveError ?
 
 

All Answers

Alain CabonAlain Cabon
Hi,

 <div class="recordSaveError">

"The 'accEdit' Lightning Component does not appear to be displaying the 'recordSaveError' value inside a div with the class 'recordError'."

recordError != recordSaveError ?
 
 
This was selected as the best answer
David M. ReedDavid M. Reed
I'm really hoping it's a typo like that on my part, but unfortunately I can't get it to pass with either class name. The example code in this module uses `class="recordSaveError"`, so I tried that, but neither class name works.
David M. ReedDavid M. Reed
Correction: @Alain Cabon is correct, but the presence of additional elements within the div breaks Trailhead's validation. The snippet below works correctly.
 
<aura:if isTrue="{! v.recordSaveError }">
            <div class="recordError">
                {! v.recordSaveError }
            </div>
    	</aura:if>

 
Alain CabonAlain Cabon
Excellent. I have sweated a lot on these challenges with exactly the same problems. I have experienced similar situations and we don't always read the error messages completely (sometimes in contradiction with the lesson or the challenge but they have very often important hints event if  they are invisible for the writer but obvious for fresh eyes )