Index: openacs-4/packages/acs-templating/www/doc/guide/wizards.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/guide/wizards.adp,v diff -u -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/acs-templating/www/doc/guide/wizards.adp 3 Sep 2021 09:16:22 -0000 1.4.2.1 +++ openacs-4/packages/acs-templating/www/doc/guide/wizards.adp 13 Jul 2023 12:48:33 -0000 1.4.2.2 @@ -16,19 +16,24 @@

Use the wizard create command to initialize a wizard, declaring any wizard state variables in the -params option:

-
wizard create make_sandwich -params { sandwich_id }
+
+wizard create make_sandwich -params { sandwich_id }
+

See the wizard API for optional parameters to this command.

Add steps

Once the wizard is created, use the wizard create command to add steps to it:

-
wizard add make_sandwich -label "Add the lettuce" -url "add-lettuce"
+
+wizard add make_sandwich -label "Add the lettuce" -url "add-lettuce"
+

In auto-generated wizards, the wizard steps appear in the order they were created. See the wizard API for optional parameters to this command. Alternatively, wizard steps can be created in the wizard create statement with the -steps option:

-
wizard create make_sandwich -action "eat-sandwich.acs?sandwich_id=$sandwich_id" -params { 
+
+wizard create make_sandwich -action "eat-sandwich.acs?sandwich_id=$sandwich_id" -params { 
   sandwich_id 
 } -steps { 
   1 -label "Add Meat"    -url "add-meat" -repeat
@@ -42,7 +47,8 @@
 statement. At any point in the wizard process, a state
 variable's value can be updated using the wizard
 set_param command.

-
# check to see if a sandwich_id has been passed in by the wizard
+
+# check to see if a sandwich_id has been passed in by the wizard
 request set_param sandwich_id -datatype integer -optional
 
 # if not, then set the sandwich_id
@@ -62,18 +68,22 @@
 
  • Adding wizard submit buttons to the form in place of the standard form submit button: -

    In the .tcl file:

    if { [wizard exists] } {
    +

    In the .tcl file:

    +if { [wizard exists] } {
       wizard submit form_name -buttons { 
         { previous "Back" } repeat { next "Continue" } { finish Save } 
       }
     } else {
       element create form_name submit -datatype keyword -widget submit
     }
    -

    In the .adp file:

    <formtemplate id=\@form_name\@ style=wizard>
    +

    In the .adp file:

    +<formtemplate id=\@form_name\@ style=wizard>
    +
  • Advancing the wizard with the wizard forward command. The page the wizard forwards to depends on which wizard submit button was pressed (next, repeat, previous, finish): -
    if { [wizard exists] } {
    +
    +if { [wizard exists] } {
       # go to the next wizard step
       wizard forward
     } else {