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
Komal WaghKomal Wagh 

cancel function is not working in lightning component.

ajay Duggi(Heptarc)ajay Duggi(Heptarc)

Dear Komal Wagh,
Check try to add onCancel event in your component

oncancel="{!c.onCancel}"

Along with controller need to add

onCancel: function(component, event, helper) {
// It will handle the cancel functionality here.
}

Please let me know if problem got resolved.

Komal WaghKomal Wagh
i have added the oncancel event using <lightning:recordform> on component but it is displaying save button also.
i just wanted cancel button.
Raj VakatiRaj Vakati
Try like this
 
<lightning:recordForm
                      objectApiName="Custom_Object__c" 
                      recordTypeId="{!v.Applicant.recordTypeId}"
                      layoutType="Compact"
                      columns="2"
                      mode = "edit"
                      onload="{!c.handleLoad}"
                      oncancel="{!c.onCancel}"
                      />
 
onCancel: function(component, event, helper) {

// Handle the cancel here.

}