Hi,
Want to ensure end date(s) do not precede start date(s). There are 5 text inputs for begin and end dates. They are:
startdate1; startdate2; startdate3; startdate4; RCbeginDate; stopdate1; stopdate2; stopdate3; stopdate4; and, RCendDate.
Of course, what I have below does not work. Any suggestions.
Call the function with this:
<cfform name="RAWH"
action="actionPage.cfm"
onsubmit="return Validation(); return Clear(); return ValiDate();"
method="post">
function ValiDate()
{
var SDate1 = document.getElementById(startdate1).value;
var SDate2 = document.getElementById(startdate2).value;
var SDate3 = document.getElementById(startdate3).value;
var SDate4 = document.getElementById(startdate4).value;
var SDate5 = document.getElementById(RCbeginDate).value;
var EDate1 = document.getElementById(stopdate1).value;
var EDate2 = document.getElementById(stopdate2).value;
var EDate3 = document.getElementById(stopdate3).value;
var EDate4 = document.getElementById(stopdate4).value;
var EDate5 = document.getElementById(RCendDate).value;
var alertReason = 'End Date must be equal to or greater
than Begin Date.';
var endDate1 = new Date(EDate1);
var startDate1 = new Date(SDate1);
var endDate2 = new Date(EDate2);
var startDate2 = new Date(SDate2);
var endDate3 = new Date(EDate3);
var startDate3 = new Date(SDate3);
var endDate4 = new Date(EDate4);
var startDate4 = new Date(SDate4);
var endDate5 = new Date(EDate5);
var startDate5 = new Date(SDate5);
if(SDate1 != '' && EDate1 != '' && startDate1 > endDate1){alert(alertReason);
if(SDate2 != '' && EDate2 != '' && startDate2 > endDate2){alert(alertReason);
if(SDate3 != '' && EDate3 != '' && startDate3 > endDate3){alert(alertReason);
if(SDate4 != '' && EDate4 != '' && startDate4 > endDate4){alert(alertReason);
if(SDate5 != '' && EDate5 != '' && startDate5 > endDate5){alert(alertReason);
return false;}
}
Thank you - JS
Want to ensure end date(s) do not precede start date(s). There are 5 text inputs for begin and end dates. They are:
startdate1; startdate2; startdate3; startdate4; RCbeginDate; stopdate1; stopdate2; stopdate3; stopdate4; and, RCendDate.
Of course, what I have below does not work. Any suggestions.
Call the function with this:
<cfform name="RAWH"
action="actionPage.cfm"
onsubmit="return Validation(); return Clear(); return ValiDate();"
method="post">
function ValiDate()
{
var SDate1 = document.getElementById(startdate1).value;
var SDate2 = document.getElementById(startdate2).value;
var SDate3 = document.getElementById(startdate3).value;
var SDate4 = document.getElementById(startdate4).value;
var SDate5 = document.getElementById(RCbeginDate).value;
var EDate1 = document.getElementById(stopdate1).value;
var EDate2 = document.getElementById(stopdate2).value;
var EDate3 = document.getElementById(stopdate3).value;
var EDate4 = document.getElementById(stopdate4).value;
var EDate5 = document.getElementById(RCendDate).value;
var alertReason = 'End Date must be equal to or greater
than Begin Date.';
var endDate1 = new Date(EDate1);
var startDate1 = new Date(SDate1);
var endDate2 = new Date(EDate2);
var startDate2 = new Date(SDate2);
var endDate3 = new Date(EDate3);
var startDate3 = new Date(SDate3);
var endDate4 = new Date(EDate4);
var startDate4 = new Date(SDate4);
var endDate5 = new Date(EDate5);
var startDate5 = new Date(SDate5);
if(SDate1 != '' && EDate1 != '' && startDate1 > endDate1){alert(alertReason);
if(SDate2 != '' && EDate2 != '' && startDate2 > endDate2){alert(alertReason);
if(SDate3 != '' && EDate3 != '' && startDate3 > endDate3){alert(alertReason);
if(SDate4 != '' && EDate4 != '' && startDate4 > endDate4){alert(alertReason);
if(SDate5 != '' && EDate5 != '' && startDate5 > endDate5){alert(alertReason);
return false;}
}
Thank you - JS