Thursday, July 19, 2007

JavaScript Validation Thing

Just a little validation JavaScript function in case anyone else needs it. yes it was for some coldfusion, but no you I am not going to make it more generalized.
function ValidateDate(theDate)
{
EnteredDate = new Date(theDate).toDateString();
EffDate = new Date("#DateFormat(getARD.IPI_EffectiveDate,'mm/dd/yyyy')#"). toDateString(); PrevDate = new Date("#DateFormat(DateAdd('yyyy',-1,getArd.IPI_EffectiveDate), 'mm/dd/yyyy')#").toDateString();

if(Date.parse(EnteredDate) < Date.parse (EffDate) && Date.parse(EnteredDate) > Date.parse(PrevDate))
{
return true;
}else{
alert('Date must be less than the effective date of the policy and no more than a year before the effective date.');
$('Anniversary_Rating_Date').value = '';
}
}

Ryan Vikander said...

heyyy I wrote that. Its good validation.

Your comments Here! Hover Your cursor to leave a comment.