ad_integer_optionlist (public)

 ad_integer_optionlist start_value end_value [ default ] \
    [ pad_to_two_p ]

Defined in packages/acs-tcl/tcl/widgets-procs.tcl

Produces an optionlist for a range of integers from start_value to end_value. If default matches one of the options, it is selected. If pad_to_two_p is 1, the option values will be padded to 2 digits with a leading 0.

Parameters:
start_value
end_value
default (optional)
pad_to_two_p (defaults to "0")

Partial Call Graph (max 5 caller/called nodes):
%3 test_ad_integer_optionlist ad_integer_optionlist (test acs-tcl) ad_integer_optionlist ad_integer_optionlist test_ad_integer_optionlist->ad_integer_optionlist

Testcases:
ad_integer_optionlist
Source code:
    # items is a list of the items you would like the user to select from
    # values is a list of corresponding option values
    # default is the value of the item to be selected
    set count 0
    set return_string ""


    for { set x $start_value } { $x <= $end_value } { incr x } {

        if { $pad_to_two_p && $x >= 0 && $x < 10 } {
            set value "0$x"
        } else {
            set value $x
        }

        if { $default == $value } {
            append return_string "<option selected=\"selected\" value=\"$value\">$value</option>\n"
        } else {
            append return_string "<option value=\"$value\">$value</option>\n"
        }
    }
    return $return_string
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-tcl/tcl/widgets-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: