Basically I am following the example in Visualforce developer guide of how to create a wizard: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_wizard.htm. I slightly changed the cancel code to make it work:
public pageReference Cancel(){
PageReference Step1 = page.opptystep1;
Step1.setRedirect(true);
return Step1;
}
But no matter I use the original code (the code in the book) or the adjusted code I pasted here. When I click cancel button without filling any fields, I am getting the error: You must enter a value for the field Account name and Contact first name. I understand they are mandatory, but it shouldn't require me to input any value to cancel the input. Any reason why it happens?