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
dfiredfire 

URL bar in browser displays previous page

I have a multi-part form (like the wizard example in the docs) which travels from page to page using "Next" and "Previous" buttons.

 

Let's say I am on page1 and click next to go to page2. When page2 is loaded the URL bar says page1. If I go back to page1 with the Previous button or onwards to page3 with the Next button, then it says page2 in the URL.

 

I would like the correct URL to be displayed with the correct page.

 

Here is a snippet of VF markup from one of the pages:

 

 

<apex:page showHeader="false" controller="studentApplicationController" >
  <apex:includeScript value="{!$Resource.jquery}" />
  <apex:includeScript value="{!$Resource.js_utils}" />
  <style type="text/css">
      .required {color:#F00;}
  </style>
  <apex:sectionHeader title="Aish Hatorah Application - All information in this application is strictly confidental" subtitle="Page 6 of 7"/>
  <apex:form >
      <apex:pageBlock title="" mode="edit" id="pageblock">
          <apex:pageMessages />
         <apex:pageBlockButtons >
             <apex:commandButton action="{!page5}" value="Previous"/>
             <apex:commandButton action="{!page7}" value="Next" onclick="return validatePage('{!$Component.pageblock}')"/>
             <apex:commandButton action="{!cancel}" value="Cancel"
                              onclick="return confirmCancel()" immediate="true"/>

         </apex:pageBlockButtons>

 

Here is the controller snippet for page redirection:

 

 

    public PageReference page6() {
      return Page.StudentApplicationPage6;
    }

    public PageReference page7() {
      return Page.StudentApplicationPage7;
    }

    public PageReference confirmPage() {
      return Page.StudentApplicationSubmitConfirmPage;
    }

 

thanks for any suggestions

 

 

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

The docs aren't hugely clear about this, but I did find this paragraph on P.79 of the Visualforce Developer's Guide:

 

--- snip ---

 

If the postback request indicates a page redirect and the redirect is to a page that uses the same controller and a proper subsetof controller extensions of the originating page, a postback request is executed for that page. Otherwise, a get request is executedfor the page.

 

--- snip ---

 

This sort of suggests to me that if the next page uses the same controller/extensions, it will be akin to a server side forward rather than going back to the browser and moving it on to the next page.  This is just my opinion though, I'm afraid.

 

You could force it on to the next page by setting the redirect value to true on the pagereference, but then you'd lose the viewstate.