Creating branching wizards
Wizard branching refers to how panel flow can be altered depending on data entered in previous panels. Branching is controlled by the wizard's XML file and JavaScript in the panel JSP pages.
About this task
Each <panel> tag in the XML file has two attributes: hasBranch and hasNext. To indicate that a panel is a branching point, set hasBranch=YES. Within that panel's JSP page, indicate which branch to follow by using the command parent.setNextBranch(String branch_panel_name), where branch_panel_name is the name of the next panel to display.
To indicate that a panel is the end of a branch, set hasNext=NO.
The following example describes the creation of branching wizards. The diagram describes the panel flow. Depending on data from the user, panel P1 may be followed by P2, P3, or P4. Similarly, panel P4 may be followed by P5 or P6.
The table of contents displays the panels as the user traverses the branches. In the preceding example, only P0 and P1 display initially. After the P4 branch is selected P0, P1, and P4 appear. Later, if no setNextBranch() is called in P4, then P5 is selected as the default next branch path. Notice that P5 does not have the "hasNext=NO" tag, so the wizard does not stop there, it goes on and stops at P6, the last panel.
The following code sample would appear in the wizard XML file for the above diagram:
<panel name="P0"
url="BranchDiscountWelcomeView"
helpKey="MC.discount.type.Help" />
<panel name="P1"
url="BranchDiscountWizTypeView"
helpKey="MC.discount.type.Help"
hasBranch="YES" /> <!-- this is a branching panel -->
<panel name="P2"
url="BranchDiscountWizOrderView"
helpKey="MC.discount.order.Help"
hasTab="NO"
hasNext="NO" <!-- no "NEXT" button from this panel, end of first branch -->
hasFinish="YES" />
<panel name="P3"
url="BranchDiscountWizPrdView"
helpKey="MC.discount.product.Help"
hasTab="NO"
hasNext="NO" <!-- no "NEXT" button from this panel, end of second branch -->
hasFinish="YES" />
<panel name="P4"
url="BranchDiscountWizCusTypeView"
helpKey="MC.discount.customtype.Help"
hasTab="NO"
hasBranch="YES" /> <!-- another branching panel -->
<panel name="P5"
url="BranchDiscountWizCusView"
helpKey="MC.discount.custom.Help"
hasTab="NO" />
<panel name="P6"
url="BranchDiscountWizRangesView"
helpKey="MC.discount.range.Help"
hasTab="NO"
hasFinish="YES" />