ad_dateentrywidget

one of the documented procedures in this installation of the ACS
Usage:
ad_dateentrywidget   column   { value "0" }
What it does:
Returns form pieces for a date entry widget. A null date may be selected.
Defined in: /web/philip/packages/acs-core/widgets-procs.tcl

Source code:


    ns_share NS
    # if you would like the default to be null, call with value= ""

    if { $value == 0 } {
	# no default, so use today
	set value  [lindex [split [ns_localsqltimestamp] " "] 0]
    } 

    set date_parts [split $value "-"]
    if { $value == "" } {
	set month ""
	set day ""
	set year ""
    } else {
	set date_parts [split $value "-"]
	set month [lindex $date_parts 1]
	set year [lindex $date_parts 0]
	set day [lindex $date_parts 2]
    }

    set output "<SELECT name=ColValue.[ns_urlencode $column].month>\n"
    append output "<OPTION>\n"
    # take care of cases like 09 for month
    regsub "^0" $month "" month
    for {set i 0} {$i < 12} {incr i} {
	if { $i == [expr $month - 1] } {
	    append output "<OPTION selected> [lindex $NS(months) $i]\n"
	} else {
	    append output "<OPTION>[lindex $NS(months) $i]\n"
	}
    }

    append output  "</SELECT><INPUT NAME=ColValue.[ns_urlencode $column].day TYPE=text SIZE=3 MAXLENGTH=2 value=\"$day\">&nbsp;<INPUT NAME=ColValue.[ns_urlencode $column].year TYPE=text SIZE=5 MAXLENGTH=4 value=\"$year\">"

     return $output


philg@mit.edu