Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Demo Two Page VF Wizard With Components And Data Sharing
<apex:page controller="WizardDemoController" docType="html-5.0">
<apex:form >
<apex:pageBlock >
<c:wizardPage1 pageController="{!self}" rendered="{!pageNumber=1}" />
<c:wizardPage2 pageController="{!self}" rendered="{!pageNumber=2}" />
<apex:pageBlockButtons >
<apex:commandButton action="{!nextPage}" value="Next" rendered="{!pageNumber<2}" />
<apex:commandButton action="{!prevPage}" value="Prev" rendered="{!pageNumber>1}" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
public class WizardDemoController {
public WizardDemoController getSelf() {
return this;
}
public String message { get; set; }
public Integer pageNumber { get; set; }
public WizardDemoController() {
pageNumber = 1;
}
public void nextPage() {
pageNumber++;
}
public void prevPage() {
pageNumber--;
}
}
<apex:component >
<apex:attribute description="Page Controller" type="WizardDemoController" name="pageController" />
<apex:pageBlockSection >
<apex:input label="Message Input" value="{!pageController.message}" />
</apex:pageBlockSection>
</apex:component>
<apex:component >
<apex:attribute description="Page Controller" type="WizardDemoController" name="pageController" />
<apex:pageBlockSection >
<apex:outputText label="Message Output" value="{!pageController.message}" />
</apex:pageBlockSection>
</apex:component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.