Please note: I have posted this question in the ColdFusion fourm as well.
I am having real problems trying to compare a date generated from 3 coldfusion select boxes and the current date.
The 3 select boxes are generated using the following ColdFusion code:
<cfselect name="ComboDay">
<option value="" selected>
<cfloop index="i" from="1" to="31">
<option value="#i#">#i#
</cfloop>
</cfselect>
<cfselect name="ComboMonth">
<option value="" selected>
<option value="1">Jan
<option value="2">Feb
<option value="3">Mar
<option value="4">Apr
<option value="5">May
<option value="6">Jun
<option value="7">Jul
<option value="8">Aug
<option value="9">Sep
<option value="109">Oct
<option value="11">Nov
<option value="12">Dec
</cfselect>
<cfselect name="ComboYear">
<option value="" selected>
<option value="2002">2002
<option value="2003">2003
<option value="2004">2004
<option value="2005">2005
<option value="2006">2006
</cfselect>
I have then written the following javascript function to ensure that the date selected is not in the past.
var ProposedDate = Form_NewSolution.ComboYear.value + "-" + Form_NewSolution.ComboMonth.value + "-" + Form_NewSolution.ComboDay.value;
var Now = new Date();
var CurrentDate = Now.getYear() + "-" + (Now.getMonth()+1) + "-" + Now.getDate()
if (ProposedDate < CurrentDate){
alert("The date you have entered has passed"
;
return;
}
For some reason it thinks that the 10th Dec 2002 is before todays date (6th Dec 2002).
Any help would be much appreciated.
I am having real problems trying to compare a date generated from 3 coldfusion select boxes and the current date.
The 3 select boxes are generated using the following ColdFusion code:
<cfselect name="ComboDay">
<option value="" selected>
<cfloop index="i" from="1" to="31">
<option value="#i#">#i#
</cfloop>
</cfselect>
<cfselect name="ComboMonth">
<option value="" selected>
<option value="1">Jan
<option value="2">Feb
<option value="3">Mar
<option value="4">Apr
<option value="5">May
<option value="6">Jun
<option value="7">Jul
<option value="8">Aug
<option value="9">Sep
<option value="109">Oct
<option value="11">Nov
<option value="12">Dec
</cfselect>
<cfselect name="ComboYear">
<option value="" selected>
<option value="2002">2002
<option value="2003">2003
<option value="2004">2004
<option value="2005">2005
<option value="2006">2006
</cfselect>
I have then written the following javascript function to ensure that the date selected is not in the past.
var ProposedDate = Form_NewSolution.ComboYear.value + "-" + Form_NewSolution.ComboMonth.value + "-" + Form_NewSolution.ComboDay.value;
var Now = new Date();
var CurrentDate = Now.getYear() + "-" + (Now.getMonth()+1) + "-" + Now.getDate()
if (ProposedDate < CurrentDate){
alert("The date you have entered has passed"
return;
}
For some reason it thinks that the 10th Dec 2002 is before todays date (6th Dec 2002).
Any help would be much appreciated.