It appears that jun yamog has unlocked some secrets about the wizard. This is what I learned from our conversation.
#test-wizard.tcl
template::wizard create -action "test-wizard" -params {
var_param1 var_param2 var_param3 #----> these are the variable/parameters that
#the wizard will keep track of
} -steps {
1 -label "Step 1" -url "step1" #---->these are the different steps w/c the wizard will go though.
2 -label "Step 2" -url "step2" # ex: Lather, rinse, repeat......
3 -label "Step 3" -url "step3"
}
template::wizard get_current_step #this gets the current step of the wizard
#if you are in step 1 it returns 1....
#note: using template::wizard will return a multirow with name wizard
#########################################################
#test-wizard.adp
<include src="@wizard:current_url@">
<multiple name="wizard">
<p>
<if @wizard.id@ eq @wizard:current_id@>
<b><i>* @wizard:current_id@ - @wizard.label@</i></b>
</if>
<else>
@wizard:current_id@ - @wizard.label@
</else>
</p>
</multiple>
########################################################
#next is the step1.tcl for the wizard
ad_form -name a_form -form {
{form_elem1:text(text) {label "Element 1"}}
} -on_submit {
template::wizard set_param var_param1 $form_elem1 #this simply sets the values of var_param1 to form_elem1
template::wizard forward #this makes the wizard go to the next step. very important!
}
template::wizard submit a_form -buttons { next } #this defines the buttons for the wizard
#buttons may be back next finish... forgot some (please try to look at the code and contribute :) )
ad_return_template form-template
##########################################################
#now step2.tcl
ad_form -name a_form -form {
{form_elem2:text(text) {label "Element 2"}}
} -on_submit {
template::wizard set_param var_param2 $form_elem2
template::wizard forward
}
template::wizard submit a_form -buttons { back next }
ad_return_template form-template
###########################################################
#finally step3.tcl
ad_page_contract {} {
var_param1:notnull
var_param2:notnull
}
ad_form -name a_form -form {
{form_elem1:text(inform) {label "Element 1"} {value $var_param1}}
{form_elem2:text(inform) {label "Element 2"} {value $var_param2}}
}
template::wizard submit a_form -buttons { back finish }
ad_return_template form-template
#since all of the variables are being kept track by the wizard then
#you can access it anytime using ad_page_contract
###########################################################
#here is also the code for form-template.adp
<formtemplate id="a_form"></formtemplate>