You need to sign in to do that
Don't have an account?
Emilien Guichard 40
Trailhead module Lightning Data Service Basics - Manipulate Records with force:recordData edit the details of an account
Hi,
I am trying to complete the challenge Lightning Data Service Basics - Manipulate Records with force:recordData and I am getting the followling error on the 'accEdit' component when I try it:
Here is my code
accEdit.cmp
accEditController.js
Could you please help me ?
I am stuck with that for hours...
Thanks a lot.
I am trying to complete the challenge Lightning Data Service Basics - Manipulate Records with force:recordData and I am getting the followling error on the 'accEdit' component when I try it:
Problem saving record, error: [{"fieldErrors":{},"pageErrors":[]}]
Here is my code
accEdit.cmp
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId"> <!--inherit recordId attribute--> <aura:attribute name="accountRecord" type="Object" /> <aura:attribute name="simpleRecord" type="Object" /> <aura:attribute name="recordError" type="String" /> <force:recordData aura:id="AccountRecordCreator" fields="Name" recordId="{!v.recordId}" targetError="{!v.recordError}" targetRecord="{!v.accountRecord}" targetFields="{!v.simpleRecord}" mode="EDIT" /> <!-- Display an editing form --> <ui:outputText value="Edit Account"/> <lightning:input aura:id="recordName" name="recordName" label="Account Name" value="{!v.accountRecord.Name}" required="true"/> <ui:button label="Save Account" press="{!c.handleSaveRecord}" class="slds-m-top--medium"/> </aura:component>
accEditController.js
({ handleSaveRecord: function(component, event, helper) { component.find("AccountRecordCreator").saveRecord($A.getCallback(function(saveResult) { if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") { console.log("Save completed successfully."); } else if (saveResult.state === "INCOMPLETE") { console.log("User is offline, device doesn't support drafts."); } else if (saveResult.state === "ERROR") { console.log('Problem saving record, error: ' + JSON.stringify(saveResult.error)); } else { console.log('Unknown problem, state: ' + saveResult.state + ', error: ' + JSON.stringify(saveResult.error)); } })) ;} })
Could you please help me ?
I am stuck with that for hours...
Thanks a lot.
accEdit.cmp
accEditController.js
All Answers
accEdit.cmp
accEditController.js
Hi All
I am getting this error -
Challenge Not yet complete... here's what's wrong:
The 'accEdit' Lightning Component does not appear to be using 'lightning:input' with the label 'Account Name' and the value '{!v.accountRecord.Name}'.
Not sure what is wrong here in lightning:input tag, Please help me fix the issue.
here is my code
accEdit Component code
I fell into the same pit. Would you try to make the lightning:input tag to one line and put "label" and "value" to the first in the tag? (i.e. before "aura:id")
Checking logic of this module seems ... :-<