Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 18, 2010 05:42 PM by shihora_dhruvi
All-Star
78956 Points
13402 Posts
MVP
Jun 17, 2009 05:59 AM|LINK
Refer here for a dd/mm/yyyy textbox
http://www.aspsnippets.com/post/2009/03/21/Dynamic-Date-Validation-using-JavaScript.aspx
Member
4 Points
2 Posts
Mar 18, 2010 05:20 AM|LINK
hi..
can u plz help me out in my problem....
can u plz tell me wht to do if my textbox date value is in the form dd-MM-yyyy.
actually i had tried the code for same but it's not working.....
plz help me out.
Mar 18, 2010 05:42 PM|LINK
<script language="javascript" type="text/javascript"> // Function to validate dates before processing function dateValidation() { var obj = document.getElementById("departdate"); var day = obj.value.split("/")[0]; var month = obj.value.split("/")[1]; var year = obj.value.split("/")[2]; if ((day<1 || day >31) || (month<1&&month>12)&&(year.length != 4)) { alert("Invalid Format");return false; } else { var dt = new Date(year, month-1, day); var today = new Date(); if((dt.getDate() != day) || (dt.getMonth() != month-1) || (dt.getFullYear()!=year) || (dt>today)) { alert("Invalid Date");return false; } } } </script>
<form name="searchflight" method="post" action="Login.jsp" > <input id="demo1" name="departdate" type="text" size="25"><a href="javascript:NewCal('demo1','ddmmyyyy')"><img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a> <br /> <input type="submit" value="search" id="btnSubmit" onclick="dateValidation()" /> </form>
plz check this code.....it's nt working...
Actually i m getting the value in textbox from datepicker. And the date the date picker provide is in the form of dd/MM/yyyy i.e 23/3/2010.
plz i request...help me out...
it's urgent...
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: how to validate textbox value(date format) < current date using Javascript when press on but...
Jun 17, 2009 05:59 AM|LINK
Refer here for a dd/mm/yyyy textbox
http://www.aspsnippets.com/post/2009/03/21/Dynamic-Date-Validation-using-JavaScript.aspx
Contact me
shihora_dhru...
Member
4 Points
2 Posts
Re: how to validate textbox value(date format) < current date using Javascript when press on but...
Mar 18, 2010 05:20 AM|LINK
hi..
can u plz help me out in my problem....
can u plz tell me wht to do if my textbox date value is in the form dd-MM-yyyy.
actually i had tried the code for same but it's not working.....
plz help me out.
shihora_dhru...
Member
4 Points
2 Posts
Re: how to validate textbox value(date format) < current date using Javascript when press on but...
Mar 18, 2010 05:42 PM|LINK
<script language="javascript" type="text/javascript">
// Function to validate dates before processing
function dateValidation()
{
var obj = document.getElementById("departdate");
var day = obj.value.split("/")[0];
var month = obj.value.split("/")[1];
var year = obj.value.split("/")[2];
if ((day<1 || day >31) || (month<1&&month>12)&&(year.length != 4))
{
alert("Invalid Format");return false;
}
else
{
var dt = new Date(year, month-1, day);
var today = new Date();
if((dt.getDate() != day) || (dt.getMonth() != month-1) || (dt.getFullYear()!=year) || (dt>today))
{
alert("Invalid Date");return false;
}
}
}
</script>
<form name="searchflight" method="post" action="Login.jsp" >
<input id="demo1" name="departdate" type="text" size="25"><a href="javascript:NewCal('demo1','ddmmyyyy')"><img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
<br />
<input type="submit" value="search" id="btnSubmit" onclick="dateValidation()" />
</form>
plz check this code.....it's nt working...
Actually i m getting the value in textbox from datepicker. And the date the date picker provide is in the form of dd/MM/yyyy i.e 23/3/2010.
plz i request...help me out...
it's urgent...