You need to sign in to do that
Don't have an account?
Raju Chi 5
cancel button help
How to add custom Cancel button in <Lightning:recordEditform> to navigate vf page when click on cancel button.
I tried myltiple ways but not navigating.
Please provide sameple code.
<lightning:recordEditForm recordId="{!v.RwaIDFromVfPage}"
objectApiName="Risk_Waiver_Agreement__c"
aura:id="recordHandler"
onload="{!c.handleLoad}"
onsubmit="{!c.handleSubmit}"
onsuccess="{!c.handleSuccess}"
>
<lightning:messages />
<div class="slds-wrap slds-text-align_center">
<lightning:button disabled="{!v.disabled}" type="submit" name="save" label="Save" />
<lightning:button type="button" name="Approve" label="Approve" />
<lightning:button type="button" name="Reassign" label="Reassign" />
<lightning:button variant="neutral" label="Cancel" title="Cancel" type="text" onclick="{!c.handleCancel}" />
handleCancel : function (component, event, helper) {
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": "/lightning/page/home"
});
urlEvent.fire();
},
And called above component from Vf page and to show the site.
I tried myltiple ways but not navigating.
Please provide sameple code.
<lightning:recordEditForm recordId="{!v.RwaIDFromVfPage}"
objectApiName="Risk_Waiver_Agreement__c"
aura:id="recordHandler"
onload="{!c.handleLoad}"
onsubmit="{!c.handleSubmit}"
onsuccess="{!c.handleSuccess}"
>
<lightning:messages />
<div class="slds-wrap slds-text-align_center">
<lightning:button disabled="{!v.disabled}" type="submit" name="save" label="Save" />
<lightning:button type="button" name="Approve" label="Approve" />
<lightning:button type="button" name="Reassign" label="Reassign" />
<lightning:button variant="neutral" label="Cancel" title="Cancel" type="text" onclick="{!c.handleCancel}" />
handleCancel : function (component, event, helper) {
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": "/lightning/page/home"
});
urlEvent.fire();
},
And called above component from Vf page and to show the site.
>> https://salesforce.stackexchange.com/questions/228556/lightningrecordform-cancel-button-unresponsive
As mentioned in the above link, can you try implementing with the use of oncancel attribute?
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.
You can check that code you only have to change some code like change button to cancel and their event as well.
COMPONENT JS CONTROLLER
VISUALFORCE PAGE (Name: VfPageToCallLightningComp)
LIGHTNING APP (Name: LightningCompForVFAPP)
Refrence Link: https://www.sfdc-lightning.com/2019/07/how-to-call-vf-page-javascript-method.html
Thanks And Regards ,
Suraj Tripathi.