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
Ken KoellnerKen Koellner 

Losing Developement frame when running multi-page wizard

We developed an application using VF that's a multi-page wizard.  It's based on an example if the VF class.  Unfortunately we've found it hard to debug as the Development mode frame is lost on the third page load so there's no way to inspect View State.  The page accumulates a lot of data so it's important to inspect via state along the way.  I've been through Tech Support with the issue twice and they say there's no way to fix it in the Apex/VF code; enter an Idea and maybe they'll improve the bahavior down the road.  The only work arounds they suggested were totally impractical.  They suggested using redirect.  But then all view state is lost between page changes.  They suggested using page parameters but putting 50-100K of data on the page parameters is not practical.

 

I coded an example to demostrate the issue.  If you load KKTestVF1.page as coded below.  You can use the first two buttons to stay on the same page.  If you have debug on, you'll keep debug mode.  But, it you ever press the third button that transfers to KKTestVF2.page, on the next button, you lose your debug mode.  VF corrupts the URL by putting "core.apexpages.devmode.url=1" on it and that turns off the debug frame. 

 

KKTestVF1.page

<apex:page controller="KKTestVFController">

	<apex:form >
		<apex:pageBlock title="Page 1">
            <apex:pageBlockButtons location="top">
				<apex:CommandButton action="{!goToNull}" value="Go To Null"/>
				<apex:CommandButton action="{!goTo1}" value="Go To 1"/>
				<apex:CommandButton action="{!goTo2}" value="Go To 2"/>
			</apex:pageBlockButtons>
           	String 1: <apex:inputText value="{!str1}"/><br/>
           	String 2: <apex:inputText value="{!str2}"/><br/>
           	String 3: <apex:inputText value="{!str3}"/>
		</apex:pageBlock>
	</apex:form>
	
</apex:page>

 

KKTest2.page--

<apex:page controller="KKTestVFController">

	<apex:form >
		<apex:pageBlock title="Page 2">
            <apex:pageBlockButtons location="top">
				<apex:CommandButton action="{!goToNull}" value="Go To Null"/>
				<apex:CommandButton action="{!goTo1}" value="Go To 1"/>
				<apex:CommandButton action="{!goTo2}" value="Go To 2"/>
			</apex:pageBlockButtons>
           	String 1: <apex:inputText value="{!str1}"/><br/>
           	String 2: <apex:inputText value="{!str2}"/><br/>
           	String 3: <apex:inputText value="{!str3}"/>
		</apex:pageBlock>
	</apex:form>
	
</apex:page>

 

 KKTestVFController--

public with sharing class KKTestVFController {

	public String str1 {get; set;}
	public String str2 {get; set;}
	public String str3 {get; set;}
	
	public KKTestVFController () {
		
		str1 = 'one';
		str2 = 'two';
		str3 = 'three';
	}
	
	public PageReference goToNull () {
		return null;
	}
	
	public PageReference goTo1 () {
		return Page.KKTestVF1;
	}
	
	public PageReference goTo2 () {
		return Page.KKTestVF2;
	}
	
}

 

 

aperezSFDCaperezSFDC

Change your second method for this:

 

public PageReference goTo2 () {
	PageReference pr = Page.KKTestVF2;
	pr.setRedirect(false);
	return pr;
}

 

Ken KoellnerKen Koellner

I don't believe redirect will work.  If you redirect, you lose view state.  If there were one or two items, they could be passed as parameters but the actually application has a large amount of complex data in the controller that must be maintained from page to page.  That's the whole idea of a 'wizard'.  It's a sequence of pages all operating on the same data refining it until it is complete and ready to be saved.

aperezSFDCaperezSFDC
that is the whole purpose of the setRedirect(false) that you do not loose view state and you can build wizards. Setting it to true (or not setting it) will make you loose the view state.