+ Start a Discussion
Shawn ClarkShawn Clark 

Override Cancel Button in SF1

I build a custom controller extension, and simply want to override the action that occurs when the user hits "Cancel", but for some reason its not working. I can call the method from another Command Button (No Results Match) and it will perform this method, but I want to leverage the standard Cancel to set a couple parameters and move them back to the Main page. Any Idea why this isn't working?
public PageReference cancel(){  
       ShowMasterCreate = true;
       ShowConnectedCreate = false;
       PageReference pageRef= new PageReference('/apex/ContactSearchMain');
       pageRef.setredirect(false);       
       return pageRef; 
       }

User-added image

Thanks, 

Shawn
 

ShashankShashank (Salesforce Developers) 
I'm afraid we cannot override the Cancel button. However, please see if this blog helps: http://bobbuzzard.blogspot.sg/2014/08/replace-visualforce-buttons-in.html