0

When cancel button is clicked in visualforce page, it has to redirect to home page.Instead I'm getting the same visualforce page.Kindly help.

public PageReference cancel()
  {
    return null;
  }

3

Method -

Using html-5 in doctype in visualforce page means you should use html-formnovalidate and immediate in cancel button. For example

<apex:commandButton action="{!cancel}" value="Cancel" immediate="true" 
                    html-formnovalidate="formnovalidate" />
1

I can see you have returned "null" from "page reference method" used for cancel. When you return null salesforce keeps redirects to same page. That is the reason when you are using this method, salesforce is keeping you at same page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.