akaballa123
Technical User
Hi,
I am trying to create a date check scenario to see if my start date greater than my end date:
This is the code im using
This scenario is placed within a checkform function that is called the users clicks on the submit button of the form.
My first case works where a error is outputted if the start year is greater than the end year. But, the other two are not responding. Like when I click submit I do not get an error and neither does the form get submitted.
I am trying to create a date check scenario to see if my start date greater than my end date:
This is the code im using
Code:
var cStartD = myForm.startDate;
var cEndD = myForm.endDate;
var startD_array = cStartD.value.split("/");
var endD_array = cEndD.value.split("/");
if(parseInt(startD_array[0]) > parseInt(endD_array[0]))
{
alert('Start Date is ahead of the End Date. Recheck the dates please!');
cStartD.focus();
return false;
}
else if(parseInt(endD_array[0]) == parseInt(startD_array[0]) )
{
if(parseInt(startD_array[1]) > parseInt(endD_array[1]) )
{
return false;
alert('Start Date is ahead of the End Date. Recheck the dates please!');
cStartD.focus();
}
else if(parseInt(endD_array[1]) == parseInt(startD_array[1]) )
{
if(parseInt(startD_array[2]) > parseInt(endD_array[2]) )
{
return false;
alert('Start Date is ahead of the End Date. Recheck the dates please!');
cStartD.focus();
}
}
}
This scenario is placed within a checkform function that is called the users clicks on the submit button of the form.
My first case works where a error is outputted if the start year is greater than the end year. But, the other two are not responding. Like when I click submit I do not get an error and neither does the form get submitted.