QUESTIONS
Question 1) Did the v4.5 Service Packs fix any Year 2000 bugs? If so,
could you point me somewhere where I might find a list of
fixes/enhancements?
Question 2) I was wondering if anyone else had encountered a year 2000 bug
in Cold Fusion?
I tried some searching on the Allaire page didn't see anything there
directly addressing this. I apologize up-front if this has been an oft
discussed subject in the past. I've come up with a work-around that I have
included at the end of the post.
Thanks in advance.
Lonny Eckert
Hesta Corporation
[EMAIL PROTECTED]
Hesta 610-230-2500 x147
**************************************************************************
PROBLEM STATEMENT
The CFINPUT tag with date validation did not enforce a four digit year check
as various sources claim (on-line help & Mastering Cold Fusion).
JavaScript is wierd in that date math is converted to milliseconds from 1970
(O'Reilly, JavaScript - the definitive guide, p445-449). The JavaScript was
parsing value from the entered_run_date textbox as if the year 2001 was
1901. Therefore, I was seeing the (selected date < today) alert message for
times that I should not have. Entering four digit years via the preceding
cfform did not manifest this problem (obviously).
**************************************************************************
SOLUTION
I derived this solution by viewing the source generated from the CF server.
<script LANGUAGE="JavaScript">
<!-- HIDE SCRIPT FROM OLDER BROWSERS.
function SubmitIt() {
//START OF FIX
isplit = document.processSchedulerForm.entered_run_date.value.indexOf('/');
sMonth = document.processSchedulerForm.entered_run_date.value.substring(0,
isplit);
isplit = document.processSchedulerForm.entered_run_date.value.indexOf('/',
isplit + 1);
sDay =
document.processSchedulerForm.entered_run_date.value.substring((sMonth.lengt
h + 1), isplit);
sYear =
document.processSchedulerForm.entered_run_date.value.substring(isplit + 1);
//END OF FIX
today = new Date();
alert (document.processSchedulerForm.entered_run_date.value);
alert (today);
selectedDate =
Date.parse(document.processSchedulerForm.entered_run_date.value);
alert (selectedDate);
today = Date.parse(today);
alert (today);
//START OF THE NEW TEST FOR PROPER YEAR LENGTH
if (sYear.length < 4) {
alert ("Please enter a date in the format MM/DD/YYYY (use four digits
for
the year)!");}
//END OF NEW TEST
else if (document.processSchedulerForm.process_mode.selectedIndex == 0) {
alert ("Please select whether you wish to Preview or Process data!" );}
else if (document.processSchedulerForm.selected_run_type.selectedIndex ==
0) {
alert ("Please select whether you want the process to run
automatically or
manually!" );}
//THIS WAS THE PROBLEM CHILD
else if (selectedDate < today) {
alert ("Please enter a Run Date no earlier than today's date. You may
not
set up an automated session for a process earlier than tomorrow (automated
processes will be set to start at 1:00 a.m.)!" );}
//THIS WAS THE PROBLEM CHILD
<cfif session.processid IS 1>
else if
(document.processSchedulerForm.selected_employer_params.selectedIndex == 0)
{
alert ("Please select an employer!" );}
else if (document.processSchedulerForm.selected_extract.selectedIndex == 0)
{
alert ("Please select an extract type!" );}
else if (document.processSchedulerForm.payroll_day.value == "") {
alert ("Please enter the Due Day!" );}
</cfif>
<cfif session.processid IS 2>
else if (document.processSchedulerForm.selected_employer.selectedIndex == 0)
{
alert ("Please select an employer!" );}
else if
(document.processSchedulerForm.selected_invoicing_month.selectedIndex == 0)
{
alert ('Please select an invoicing month!');}
</cfif>
<cfif session.processid IS 3>
else if (document.processSchedulerForm.cutoff_date.selectedIndex == 0) {
alert ('Please select a cutoff date!');}
</cfif>
else {
document.processSchedulerForm.action =
"index.cfm?fuseaction=actScheduleProcess";
document.processSchedulerForm.submit();
}
}
<cfif session.processid IS 1>
function ReloadSelection() {
//var
params="index.cfm?fuseaction=displayProcessScheduler&selected_employer=v_sel
ected_employer";
//location.href(params);
document.processSchedulerForm.action =
"index.cfm?fuseaction=addScheduledProcess";
document.processSchedulerForm.submit();
}
</cfif>
// END OF HIDE SCRIPT FROM OLDER BROWSERS. -->
</script>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists