Validate two date fields using javascript.
function ValidateDates()
{
var startdate = Xrm.Page.getAttribute("jmh_invoicedate").getValue();
var dueby = Xrm.Page.getAttribute("jmh_daterecieved").getValue();
if(startdate != null && dueby != null)
{
if(dueby.setHours(0,0,0,0) < startdate.setHours(0,0,0,0))
{
alert("Recieved Date must be greater than or equal to Invoice Date");
var pass = Xrm.Page.data.entity.attributes.get("jmh_daterecieved");
pass.setValue(null);
//event.returnValue = false;
//return false;
}
}
}
No comments:
Post a Comment