i have one date field i want to validate that field
that date should not be less that current date
if it is there show alert box
pls tell solution for this
i have one date field i want to validate that field
that date should not be less that current date
if it is there show alert box
pls tell solution for this
Jump to Posthelloo try this..
<script> function ValidateDate(CtrlSDate,CtrlEDate) { var SDate = document.getElementById(CtrlSDate).value; var calendarDate = getCalendarDate(); var alertReason1 = 'End Date must be greater than or equal to Start Date.' var endDate = new Date(calendarDate); var startDate= new Date(SDate); if(SDate != '' && EDate != '' && startDate …
helloo try this..
<script>
function ValidateDate(CtrlSDate,CtrlEDate)
{
var SDate = document.getElementById(CtrlSDate).value;
var calendarDate = getCalendarDate();
var alertReason1 = 'End Date must be greater than or equal to Start Date.'
var endDate = new Date(calendarDate);
var startDate= new Date(SDate);
if(SDate != '' && EDate != '' && startDate > endDate)
{
alert(alertReason1);
document.getElementById(CtrlEDate).value = "";
return false;
}
}
</script>
Incase if user select from date as 10/7/2008 and to data as 15/6/2008 it is not validating the date.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.