kwizcom banner advertisement

SharePoint 2007 Start Date End Date Validation in List forms with JavaScript

SharePoint 2007 Start Date End Date Validation in List forms with JavaScript:
<script language="javascript"> 
function PreSaveAction()
{
var blFlag;
blFlag = true;

var SOSOccDate = getTagFromIdentifierAndTitle("INPUT","DateTimeFieldDate","Date SOS Occurred"); 

var DUEDate = getTagFromIdentifierAndTitle("INPUT","DateTimeFieldDate","Due date"); 

var dtSOSOccDate = new Date(SOSOccDate.value);
var dtDUEDate = new Date(DUEDate.value);
var TodaysDate = new Date();

if(dtSOSOccDate != null)
{
if(dtSOSOccDate > TodaysDate)
{
alert("Date SOS Occured cannot be greater than today's date");
}
}

if(DUEDate.value != "")
{
if(dtDUEDate < dtSOSOccDate)
{ 
alert("The Due date cannot happen earlier than the SOS occurred date"); 
blFlag = false; // Cancel the item save process 
}
}
return blFlag; // OK to proceed with the save item 
}
</script>
SharePoint 2007 Start Date End Date Validation in List forms with JavaScript SharePoint 2007 Start Date End Date Validation in List forms with JavaScript Reviewed by Salaudeen Rajack on July 09, 2010 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.