Thursday, November 25, 2010

Restrict Future date in CRM and restrict save event

To avoid future date in a date field in CRM Form and restrict save in such cases:

var today = new Date();

var filledDate = crmForm.all.new_testdate.DataValue;

if(filledDate > today)
{
   alert('filled in date is a future date. please enter appropriate date.');

 event.returnValue = false;
     return false;
}


To restrict save of crmfrom, we need to execute the following script onsave of the form.

 event.returnValue = false;
     return false; // if this line is not added, the rest of the script that follows this will get executed. 

No comments:

Post a Comment