Hai,
I have created a date which is a pull down menu for a booking system. I have done validation to the date so when a user chooses a date for example today's date 30 August 2000 then it should allow the user to book or the next day and if the user chooses 29 August 2000, then a Pop up message like "Select valid date" will be displayed.
My problem here is that the code which i wrote does not accept todays date which is going to be a problem because just say there are users who want to book anything today then it is going to be difficult. I am taking the system date. The code is as below where i have done my validation. Could you tell me where i have gone wrong.
<script ="javascript">
function check(nform)
{
var dd=nform.day.options[nform.day.selectedIndex].value;
var dm=nform.month.options[nform.month.selectedIndex].value;
var dy=nform.year.options[nform.year.selectedIndex].value;
var vdate=dm + "/" + dd + "/" + dy;
var now=new Date(vdate);
var sysdate=new Date();
if(now<sysdate)
{
alert("Select valid date"
nform.day.focus();
return false;
}
return true;
}
</script>
dip.
I have created a date which is a pull down menu for a booking system. I have done validation to the date so when a user chooses a date for example today's date 30 August 2000 then it should allow the user to book or the next day and if the user chooses 29 August 2000, then a Pop up message like "Select valid date" will be displayed.
My problem here is that the code which i wrote does not accept todays date which is going to be a problem because just say there are users who want to book anything today then it is going to be difficult. I am taking the system date. The code is as below where i have done my validation. Could you tell me where i have gone wrong.
<script ="javascript">
function check(nform)
{
var dd=nform.day.options[nform.day.selectedIndex].value;
var dm=nform.month.options[nform.month.selectedIndex].value;
var dy=nform.year.options[nform.year.selectedIndex].value;
var vdate=dm + "/" + dd + "/" + dy;
var now=new Date(vdate);
var sysdate=new Date();
if(now<sysdate)
{
alert("Select valid date"
nform.day.focus();
return false;
}
return true;
}
</script>
dip.