Newer Version Available
force:recordSaveSuccess
force:recordSaveSuccess is used with the
force:recordEdit component. This examples
shows a force:recordEdit component, which takes
in user input to update a record specified by the recordId attribute. The button fires the force:recordSave
event.
1<aura:attribute name="recordId" type="String" default="a02D0000006V8Ni"/>
2<aura:attribute name="saveState" type="String" default="UNSAVED" />
3<aura:handler name="onSaveSuccess" event="force:recordSaveSuccess" action="{!c.handleSaveSuccess}"/>
4
5<force:recordEdit aura:id="edit" recordId="{!v.recordId}" />
6<ui:button label="Save" press="{!c.save}"/>
7Record save status: {!v.saveState}This client-side controller fires the event to save the record and handle it accordingly.
1({
2 save : function(cmp, event) {
3 // Save the record
4 cmp.find("edit").get("e.recordSave").fire();
5 },
6
7 handleSaveSuccess : function(cmp, event) {
8 // Display the save status
9 cmp.set("v.saveState", "SAVED");
10 }
11})