I know lot of folks would you say this topic was covered previously. Please do check out the question once, if its updated please provide me the link.
Scenario : I want to take an wizard flow. Two pages and one controller.
1st page : user will select month and year in picklist and click on button. Controller method will be called and there 3 queries will run ( long ones ), then user will be redirected to second page ( with setRedirect as false)
2nd page : This page will contain 4 data tables which will be rendered as pdf.
problem : In the first page after clicking on button its not redirecting ( no errors, i have added pageMessages and no exceptions, i have added catch block also).
PageReference pageRef = new PageReference ('/.....');
return pageRef;
or
return Page.PageName;
I have tried both but its not redirecting.
Am i missing anything?
Update : I have done on the similar lines ( below link ), but its not working.
http://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_wizard.htm
Update :
Pasting the simplified code
Page :
.tableStyling
{
padding:15px;
}
</style>
<apex:form >
<apex:outputPanel > // This block will be hidden for page 2
<apex:pageMessages ></apex:pageMessages>
<apex:outputLabel value="Month" />
<apex:selectlist multiselect="false" size="1" value="{!Month}">
<apex:selectOption itemValue="01" itemLabel="Jan"/>
.
.
<apex:selectOption itemValue="12" itemLabel="Dec"/>
</apex:selectList>
<apex:outputLabel value="Year" />
<apex:selectlist multiselect="false" size="1" value="{!Year}">
<apex:selectOption itemValue="2012" itemLabel="2012"/>
.
.
<apex:selectOption itemValue="2017" itemLabel="2017"/>
</apex:selectList>
<apex:commandButton value="GO" reRender="output,thePage" action="{!processCommission}" status="image"/>
<apex:actionStatus id="image">
<apex:facet name="start">
<img class="waitingImage" src="/img/loading.gif" title="Getting Values for you..." />
</apex:facet>
</apex:actionStatus>
</apex:outputPanel>
<apex:pageBlock id="output" rendered="false"> // Block Hidden for page 1
<apex:outputText value="Producer" style="font-size : 18px;font-weight:bold;color : red"/>
<br /><br /><br />
<apex:dataTable value="" var="" width="100%" >
<apex:column value="" headerValue="Name" styleClass="tableStyling"/>
More Columns
</apex:dataTable>
<br /><br /><br />
<apex:outputText value="Commission by Producer" style="font-size : 18px;font-weight:bold;color : red"/>
<br /><br /><br />
<apex:dataTable value="" var="" width="100%" >
<apex:column value="" headerValue="CWP" styleClass="tableStyling"/>
More Columns
</apex:dataTable>
<br /><br /><br />
<apex:outputText value="Commission by Insurance Companies" style="font-size : 18px;font-weight:bold;color : red"/>
<br /><br /><br />
<apex:dataTable value="" var="" width="100%">
<apex:column value="" headerValue="Name" styleClass="tableStyling"/>
More Columns
</apex:dataTable>
<br /><br /><br />
<apex:outputText value="Commission by Payment Detail" style="font-size : 18px;font-weight:bold;color : red"/>
<br /><br /><br />
<apex:dataTable value="" var="" width="100%" >
<apex:column value="" headerValue="Name" styleClass="tableStyling"/>
More Columns
</apex:dataTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller :
Controller contains only gettters and setters and this method
public with sharing class CommissionSlipController { // Setters and getter for components in page public PageReference processCommission() { String con = y+m ; ContactIns = [SOQL 1]; CommProdIns = [ SOQL 2 ]; CommCompIns = [ SOQL 3 ]; CommPaymIns = [ SOQL 4]; return Page.PageName; } }
Is anything missing?
Upate : Figure it out...Duhh!!! I forgot to take out reRender attribute on button, that little fellow was stopping the page from getting redirecting.
Thanks all