Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System date

Status
Not open for further replies.

dip

Programmer
Aug 15, 2000
20
SG
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 =&quot;javascript&quot;>
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 + &quot;/&quot; + dd + &quot;/&quot; + dy;

var now=new Date(vdate);
var sysdate=new Date();

if(now<sysdate)
{
alert(&quot;Select valid date&quot;);
nform.day.focus();
return false;
}
return true;
}
</script>


dip.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top