# # This Example shows you how to handle checkboxes in a form. # # set flag set first_load "on" # see confirmation form example proc page {title code} { web::putx {{web::put $title}

{web::put $title}

} uplevel $code web::put "\n" } # see confirmation form example proc form {page code} { web::put "
" uplevel $code web::put "
" } proc showForm {error} { global first_load # generate a page with Title "File upload example" page "checkbox example" { # generate a form with action "submit" # the return value of a checkbox is no value or "on" form "submit" { # web::match is used to search the value "on" in the variables time_flag and firstload. # If the value is found it returns a checked. web::putx {
Please choose the information that should be displayed.

Time Day Date
{set output [web::match "%T  " [web::formvar time_flag $first_load] "on"]} {append output [web::match "%A  " [web::formvar day_flag $first_load] "on"]} {append output [web::match "%d.%m.%Y" [web::formvar date_flag $first_load] "on"]} {web::put [clock format [clock seconds] -format $output]}
} } } } # see confirmation form example web::command default { showForm 0 } # With the set first_load 0 we know that the showForm is not displayed # the first time. # See also confirmation form example. web::command submit { set first_load 0 showForm 0 } #see dispatch example web::dispatch