download_date_form_check form date_nameWhat it does:
checks that date_name is a valid date. Returns a list of date_name exception_count, exception_text. Sets date_name to a YYYY-MM-DD format.Defined in: /web/philip/tcl/download-defs.tcl
Source code:
set encoded_date [ns_urlencode $date_name] ns_set update $form "ColValue.$encoded_date.day" [string trimleft [ns_set get $form ColValue.$encoded_date.day] "0"] # check that either all elements are blank or date is formated # correctly for ns_dbformvalue if { [empty_string_p [ns_set get $form ColValue.$encoded_date.day]] && [empty_string_p [ns_set get $form ColValue.$encoded_date.year]] && [empty_string_p [ns_set get $form ColValue.$encoded_date.month]] } { return [list "" 0 ""] } elseif { [catch { ns_dbformvalue $form $date_name date $date_name} errmsg ] } { return [list "" 1 "<li>The date or time was specified in the wrong format. The date should be in the format Month DD YYYY.\n"] } elseif { ![empty_string_p [ns_set get $form ColValue.$encoded_date.year]] && [string length [ns_set get $form ColValue.$encoded_date.year]] != 4 } { return [list "" 1 "<li>The year needs to contain 4 digits.\n"] } return [list [set $date_name] 0 ""]