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
Manikandan C 14Manikandan C 14 

Cancel Button ask to fill required fields. How Can i Overcome this.

Friends, I have created a visual force page with cancel button. but when i click cancel button the page ask me to fill  required fields. How Can i Overcome this . My requirement is when i click cancel button it has to go list view page. 

Here My code
Apex:

Public Pagereference docancel(){      
    PageReference pageRef = new PageReference('/001/o');   
    pageRef.setRedirect(true);
    return pageRef;   
    }
Best Answer chosen by Manikandan C 14
DeveloperSudDeveloperSud
Hi use immediate="true" in your commandbutton you used for cancel.Let us know if this works.
<apex:commandButton value="Cancel" action="{!cancel}" immediate="true" />

 

All Answers

DeveloperSudDeveloperSud
Hi use immediate="true" in your commandbutton you used for cancel.Let us know if this works.
<apex:commandButton value="Cancel" action="{!cancel}" immediate="true" />

 
This was selected as the best answer
Manikandan C 14Manikandan C 14
It's Working .Thank you for your Quick Reply @Sudipto Dutta
Virendra ChouhanVirendra Chouhan
@DeveloperSud is correct. But @Manikandan cant you use standard Cancel Button instead of custom one?