hi guys, i have below a script that checks if there's a date and if it's in the format i need. and this works. but what i'd like to do is to also check if the entered date is before a certain date (e.g. 01-jan-2010). if the date entered is before that date, then a poup should show. any idea how i could do it?
thanks
Code:
<script type="text/javascript" language="javascript">
function formCheck(){
var theForm = document.forms['form1'];
var dte_textfieldRE = /^(0[1-9]|[12][0-9]|3[01])\-((jan)|(feb)|(mar)|(apr)|(may)|(jun)|(jul)|(aug)|(sep)|(oct)|(nov)|(dec))\-(19|20)\d\d$/i;
var errMsg = "";
var setfocus = "";
if (!dte_textfieldRE.test(theForm['textfield'].value)){
errMsg = "Date is required";
setfocus = "['textfield']";
}
if (errMsg != ""){
alert(errMsg);
eval("theForm" + setfocus + ".focus()");
}
else theForm.submit();
}
</script>
</head>
<body>
<form action="" method="post" name="form1" id="form1" onsubmit="formCheck();return false;">
<input type="text" name="textfield" />
<input type="submit" name="Submit" value="Submit" />
</form>