template::wizard::submit (public)

 template::wizard::submit form_id [ args... ]

Defined in packages/acs-templating/tcl/wizard-procs.tcl

Add the appropriate buttons to the submit wizard Also create a list of all the buttons The optional -buttons parameter is a list of name-value pairs, in form {name label} {name label...} The valid button names are back, next, repeat, finish

Also writes the params to the form as hidden elements to keep the state of the wizard.

The following values are acceptable for the buttons: back, next and finish. Back buttons are not rendered if the step is the first step, like wise next buttons are not displayed if its the last step. Finish can appear on any step and will finish the current wizard even if not all steps are done.

Parameters:
form_id (required)
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 template::adp_level template::adp_level (public) template::element template::element (public) template::element::exists template::element::exists (public) template::util::get_opts template::util::get_opts (public) template::wizard::current_step template::wizard::current_step (private) template::wizard::submit template::wizard::submit template::wizard::submit->template::adp_level template::wizard::submit->template::element template::wizard::submit->template::element::exists template::wizard::submit->template::util::get_opts template::wizard::submit->template::wizard::current_step

Testcases:
No testcase defined.
Source code:

    variable default_button_labels

    get_reference
    upvar 2 wizard_submit_buttons buttons
    set buttons [list]

    set param_level [template::adp_level]
    upvar #$param_level wizard:params params

    template::util::get_opts $args

    # Handle the -buttons parameter
    if { ![info exists opts(buttons)] } {
        # jkyamog - is this really correct?  when no buttons is present we put all of the buttons?
        upvar 0 default_button_labels button_labels
    } else {
        foreach pair $opts(buttons) {
            # If provided with just a name, use default label
            if { [llength $pair] == 1 } {
                set button_labels($pair$default_button_labels($pair)
            } else {
                set button_labels([lindex $pair 0]) [lindex $pair 1]
            }
        }
    }

    # Add a hidden element for the current wizard name
    template::element create $form_id wizard_name -widget hidden -value $wizard_name -datatype keyword

    set current_id [current_step]

    # Add a hidden element with the current ID
    template::element create $form_id wizard_step${wizard_name} -widget hidden -value $current_id -datatype keyword


    set step_index [expr {[lsearch -exact $steps $current_id] + 1}]

    # If not the first one and it is allowed than add a "Back" button
    if { $step_index > 1 && [info exists button_labels(back)] } {
        template::element create $form_id wizard_submit_back -widget submit  -label $button_labels(back) -optional -datatype text

        lappend buttons wizard_submit_back
    }

    # If iteration is allowed than add a "Repeat" button
    upvar #$level wizard:$current_id step
    if { [info exists step(repeat)] && [info exists button_labels(repeat)]} {
        template::element create $form_id wizard_submit_repeat -widget submit  -label $button_labels(repeat) -optional -datatype text
        lappend buttons wizard_submit_repeat
    }

    # If not the last one than add a "Next" button
    if { $step_index < [llength $steps] && [info exists button_labels(next)] } {
        template::element create $form_id wizard_submit_next -widget submit  -label $button_labels(next) -optional -datatype text
        lappend buttons wizard_submit_next
    }

    # Always finish
    if { [info exists button_labels(finish) ] } {
        template::element create $form_id wizard_submit_finish -widget submit  -label $button_labels(finish) -optional -datatype text
        lappend buttons wizard_submit_finish
    }


    # Create hidden variables for wizard parameters
    set levels [get_wizards_levels]
    lappend levels $level

    foreach onelevel $levels {
        upvar #$onelevel wizard:properties properties
        foreach param $properties(params) {
            if { ![template::element::exists $form_id $param] } {
                if { [info exists params($param)] } {
                    template::element create $form_id $param -widget hidden -datatype text -optional -param -value $params($param)
                } else {
                    template::element create $form_id $param -widget hidden -datatype text -optional -param
                }
            }
        }

    }

    # Create hidden variables for the other wizard steps and visited steps
    foreach one_wizard $wizards {
        if { ![template::element::exists $form_id wizard_step${one_wizard}] } {
            template::element create $form_id wizard_step${one_wizard} -widget hidden  -datatype keyword -value [ns_queryget wizard_step${one_wizard}]
        }
        if { ![template::element::exists $form_id wizard_visitedstep${one_wizard}] } {
            template::element create $form_id wizard_visitedstep${one_wizard} -widget hidden  -datatype keyword -value [ns_queryget wizard_visitedstep${one_wizard}]
        }
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: