+ Start a Discussion
vleandrovleandro 

Manipulate Records with force:recordData - Error with Sample Code!

I'm having problems getting the sample code within the Trailhead to work.  Specifically the code for ldsSaveRecord.cmp.  This is exactly what the code is that was provided, however, when I try and save the component, I get the following error:

FIELD_INTEGRITY_EXCEPTION
Failed to save undefined: The attribute "required" was not found on the COMPONENT markup://ui:outputText: Source

Any ideas on what the problem might be?   Thank you for your time and thoughts!
 
<aura:component implements="flexipage:availableForRecordHome, force:hasRecordId"> <!--inherit recordId attribute-->

<aura:attribute name="record" type="Object" />
<aura:attribute name="simpleRecord" type="Object" />
<aura:attribute name="recordError" type="String" />

<force:recordData aura:id="recordEditor"
    layoutType="FULL"
    recordId="{!v.recordId}"
    targetError="{!v.recordError}"
    targetRecord="{!v.record}"
    targetFields ="{!v.simpleRecord}"
    mode="EDIT" />

    <!-- Display a header with details about the record -->
    <div class="slds-form--stacked">
        <div class="slds-form-element">
            <label class="slds-form-element__label" for="recordName">Name: </label>
            <div class="slds-form-element__control">
              <ui:outputText class="slds-input" aura:id="recordName"
                value="{!v.simpleRecord.Name}" required="true"/>
            </div>
        </div>
    </div>

    <!-- Display Lightning Data Service errors, if any -->
    <aura:if isTrue="{!not(empty(v.recordError))}">
        <div class="recordError">
            <ui:message title="Error" severity="error" closable="true">
                {!v.recordError}
            </ui:message>
        </div>
    </aura:if>

    <!-- Display an editing form -->
    <lightning:input aura:id="recordName" name="recordName" label="Name"
                  value="{!v.simpleRecord.Name}" required="true"/>

     <lightning:button label="Save Record" onclick="{!c.handleSaveRecord}"
               variant="brand" class="slds-m-top--medium"/>
</aura:component>

 
Best Answer chosen by vleandro
vleandrovleandro
I looked up ui:outputText and there is NO "required" attribute.  I remoeved that and the code works.
 
<aura:component implements="flexipage:availableForRecordHome, force:hasRecordId"> <!--inherit recordId attribute-->

<aura:attribute name="record" type="Object" />
<aura:attribute name="simpleRecord" type="Object" />
<aura:attribute name="recordError" type="String" />

<force:recordData aura:id="recordEditor"
    layoutType="FULL"
    recordId="{!v.recordId}"
    targetError="{!v.recordError}"
    targetRecord="{!v.record}"
    targetFields ="{!v.simpleRecord}"
    mode="EDIT" />
    
    <!-- Display a header with details about the record -->
    <div class="slds-form--stacked">
        <div class="slds-form-element">
            <label class="slds-form-element__label" for="recordName">Name: </label>
            <div class="slds-form-element__control">
              <ui:outputText class="slds-input" aura:id="recordName"
                value="{!v.simpleRecord.Name}" />
            </div>
        </div>
    </div>
    <!-- Display Lightning Data Service errors, if any -->
    <aura:if isTrue="{!not(empty(v.recordError))}">
        <div class="recordError">
            <ui:message title="Error" severity="error" closable="true">
                {!v.recordError}
            </ui:message>
        </div>
    </aura:if>
    <!-- Display an editing form -->
    <lightning:input aura:id="recordName" name="recordName" label="Name"
                  value="{!v.simpleRecord.Name}" required="true"/>

     <lightning:button label="Save Record" onclick="{!c.handleSaveRecord}"
               variant="brand" class="slds-m-top--medium"/>

</aura:component>