+ Start a Discussion
Shiv ShankarShiv Shankar 

Custom validation on wizard pages

Hello Friends, I am getting 1 problem during validation in wizard.

 

What i am doing : 

A. In controller i am having one function namely step2 with return type PageReference.

What it does :

1. Validate the data which is on step1 Form.

2. If Data is validate returns PageReference for next step in wizard.

3.  If Data is not validate returns null to stay on same page.

 

B. In Visual force page I am having

1.   <apex:outputPanel id="errorMsg">

              <apex:outputPanel rendered="{! validate == false}"> My Error Message </apex:outputPanel>

       </apex:outputPanel>

2. <apex:commandButton action{! step2} reRendere="errorMsg">

 

C. Problem :

When data is not validate controller returns null PageReference and my errorMsg outputPanel reRenders and i gets the error. But when  data is validate and function returns PageReference for next page than i am not rendering to Next Page.

I thinks:

Since i have reRender attribute with command button than if function returns next page reference but page stays on same page to rerender the outputPanel. I do not what can be the solution and where exactly i am wrong. Immediate help required.