dp_read_checkboxes { hidden_field_name "_cv" } { off_value "N" }What it does:
Reads all checkboxes in the form and sets their value to either Y or N. Note that this function looks for a hidden field named hidden_field_name to get a list of all marked and unmarked checkboxes. This should be used in conjunction with dp_insert_checkbox that sets up the hidden fields automatically.Defined in: /web/philip/tcl/data-pipeline-defs.tcl
Source code:
upvar dp_form dp_form
set size [ns_set size $dp_form]
set i 0
while {$i<$size} {
if { [ns_set key $dp_form $i] == $hidden_field_name} {
# list_of_vars will be created if it doesn't exist
lappend list_of_vars [ns_set value $dp_form $i]
}
incr i
}
if { ![info exists list_of_vars] || [empty_string_p $list_of_vars] } {
return
}
foreach cb_var $list_of_vars {
set val [ns_set get $dp_form $cb_var]
if {[empty_string_p $val]} {
ns_set put $dp_form $cb_var $off_value
}
}
return