Javascript Calendar
The code below can be used for any application and supports international date formats. The function is called using 3 parameters as described in the code comments. The code supports the same valid time data type functionality as a notes client including date format styles "MDY, DMY, YMD", and date format separators "back slash, dash, period" which depends on the server date setting.i.e. Valid formats for March 1st, 2006 using MDY format style and back slash format separator: 3/1/2006, 03/06, 03/01/2006, 3/1/06, 03/01/06, etc.
The code can be copy/pasted into the $$HTMLHead field, but be sure to disable the submit button if the code fails. Feel free to use the code, but please do not remove the comment which denotes myself as developer since I have seen my code plagiarized in the past in a United Kingdom Notes publication.NOTE: If you are using a global application replicating on servers which do not have the same date format settings you can access the NotesInternational class in a LotusScript agent prior to opening a form which can set a flag or cookie to determine the JavaScript call parameters.If you are looking for a virtual web calendar pop-up which a user can click to automatically populate a web form field then visit IVE Technologies%26#39; web site: http://www.ivesco.com
Formula Code:"JAVASCRIPT LANGUAGE=\"JavaScript\"%26gt;" CR "DateErrorMsg = \"Field Contains Incorrect Value\\n\\nUnable to interpret Timeor Date\";" CR "if (!IsNotesDate(document.forms[0].txt_date1.value, 1, 1))alert(DateErrorMsg);" CR "function IsNotesDate(txt_date, num_style, num_sep) {" CR "//" CR "// INTERNATIONAL DATE VALIDATION" CR "// Coded by Lance Zakin - lzakin@ivesco.com" CR "//" CR "// PARAMETERS" CR "// txt_date: Date (text data type) i.e. 01/01/2000" CR "// num_style: Date Format Style (number data type) i.e. 1 = MDY, 2 = DMY, 3= YMD" CR "// num_sep: Date Format Separator (number data type) i.e. 1 = back slash, 2= dash, 3 = period" CR "//" CR "if (txt_date.replace(/ /g, \"\") == \"\" || txt_date.toLowerCase() ==\"today\" || txt_date.toLowerCase() == \"tomorrow\" || txt_date.toLowerCase()== \"yesterday\") return 1;" CR "len = txt_date.length;" CR "if (num_sep == 1) sep = \"/\";" CR "if (num_sep == 2) sep = \"-\";" CR "if (num_sep == 3) sep = \".\";" CR "parse1 = txt_date;" CR "pos1 = parse1.indexOf(sep);" CR "data1= parseInt(parse1.substring(0, pos1));" CR "parse2 = parse1.substring(pos1 1, len);" CR "pos2 = parse2.indexOf(sep);" CR "if (pos2 != -1) data2 = parseInt(parse2.substring(0, pos2)); else dat a2 =parseInt(parse2.substring(0, len));" CR "parse3 = parse2.substring(pos2 1, len);" CR "data3 = parseInt(parse3.substring(0, len));" CR "if (data3 %26lt; 50) data3 = 2000 data3;" CR "var theDate = new Date();" CR "txt_date = data1.toString() sep data2.toString() sep data3.toString();" CR "if (pos2 == -1 %26%26 (num_style == 1 || num_style == 2)) { data3 =theDate.getYear() 1900;" CR "txt_date = data1.toString() sep data2.toString() sep data3.toString();" CR "}" CR "if (pos2 == -1 %26%26 num_style == 3) { data3 = theDate.getYear() 1900;" CR "txt_date = data3.toString() sep data1.toString() sep data2.toString();" CR "}" CR "var theDate = new Date(txt_date);" CR "if (num_style == 1) mos = data1; else mos = data2;" CR "if (theDate.getMonth() != mos-1) return 0;" CR "return 1;" CR "}" CR " "
創作者介紹
創作者 愛PO吧遊樂資訊網 的頭像
ipobar

愛PO吧遊樂資訊網

ipobar 發表在 痞客邦 留言(0) 人氣( 0 )