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;
        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?


To Skip validation rules, set attribute immediate=true like this

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

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.