I'm working on a page with two dates displayed in
two textfialds (startDate and endDate).
User enters them from js calendar. After that, and before
db search, dates have to be validated -
startDate > today
endDate > startDate
startDate <> endDate
I written function as below:
It work OK only for third case, and not for other two. Does anybody have solution ?
two textfialds (startDate and endDate).
User enters them from js calendar. After that, and before
db search, dates have to be validated -
startDate > today
endDate > startDate
startDate <> endDate
I written function as below:
Code:
function search()
{
valid = true;
var startdate = new Date(form.datum1.value)
var enddate = new Date(form.datum2.value)
var today = new Date ()
if (today > startdate)
{
alert ('Please, enter correct "Date from" !');
datum1.focus();
return false;
}
if (startdate == enddate)
{
alert ('Please, enter correct "Date to" !');
datum2.focus();
return false;
}
if (startdate > enddate)
{
alert ('Please, enter correct "Date to" !');
datum2.focus();
return false;
}
else
frmL.action = "rezultati-rez.asp"
method = "POST"
frmL.submit()
}
It work OK only for third case, and not for other two. Does anybody have solution ?