fnDatePicker(...) DESCRIPTION This function returns an HTML string which generates three SELECT boxes (day, month, year) and a HIDDEN element on a web page which provide a simple mechanism for a user to select Date values. The boxes prevent the entry of illegal dates (e.g 29 Feb 1999). The hidden element remains synchronised to the combined value of the three SELECT boxes. SYNTAX <%= fnDatePicker([sElementName], [sValue], [sYearRange], [bHasBlanks]) %> EXAMPLE <%@ Language=VBScript %> <% Response.Buffer = true %> Using the 'fnDatePicker' function
<% '-->-->-->-->-->-->-->-->--> Response.Write fnDatePicker() '--<--<--<--<--<--<--<--<--< %>
RESULTS (approx) PARAMETERS [sElementName] {string, default=[?]}\ This is the name attribute which is given to the hidden element which contains the combined date value. This name can be used when the form is submitted to obtain the date value of the Date Picker. Spaces in the DatePickers name are not advised. [sValue] {string, default=[todays date]} This is the initially selected date for the date picker. The string should be in the format 'month, day, year' if numbers are used. (e.g. 2/20/1990) Month names are also allowed (e.g. 3 Mar 2000). The separator can be a comma, forward-slash or a space (e.g. 3,30,1990 and 3/30/1990 and 3 30 1990 are valid dates) [sYearRange] {string default=20 years below and above the initial year} A range of years to be used by the Date Picker in the form 4digits followed by any separator followed by 4digits (examples '1899>2003', '1750;2010', '1980-2100') if the format is incorrect then the range will be ignored [bHasBlanks] {boolean, default=true}i determines whether the date picker has a blank element or not. STATUS working, tested 30% DEPENDENCIES fnErrorMessage [fnErrorMessage.asp], Client-side JavaScript functions fnSynchronizeHidden() [fnDatePicker.asp] fnLegalDate(), [fnDatePicker.asp] fnIsLeapYear() [fnDatePicker.asp] LAST MODIFIED 12 April 2000 HISTORY Aug 2000, attempted a port to Perl CGI, see LibraryCode\Perl\CgiScripts\SourceCode1\fnDatePicker.asp PROGRAMMER Matthew Bishop (matth3wbishop@yahoo.com) LOCATION http://www.geocities.com/matth3wbishop/eg/asp/ DOCUMENTATION www.geocities.com/matth3wbishop/eg/asp/doc/ COMMENTS: a) The values of the three boxes default to todays date b) If the boxes are required to be initially blank, assign a value of "0" c) If any of the boxes are blank then the hidden element has "null" (a string) as its value d) The hidden element has its date string in an American format (month/day/year) e) The date values have a month value based on 1 (not zero). The hidden element also returns a one based month value g) The date picker must be enclosed in form tags h) This function may be ported soon (31 Aug 2000) to Java and Perl cgi. i) I may change the naming convention for Documentation files to DOCfilename.txt j) This entire function could be client side Javascript (using 'Document.write' method which would remove the need for any ASP environment setup