开发者

Dynamics crm onchange event Validating if a specified date falls within a date range

I am trying to set up an onchange event within MS Dynamics CRM that brings up an alert if a date entered in 开发者_JAVA百科a field falls outside of a specified range.

{
if (crmForm.all.fielddate.DataValue < 01/01/2010 || crmForm.all.fielddate.DataValue >= 01/01/2011)
{
alert("Specified date falls outside of the date range") ;
}
}

This doesnt seem to work, am I using the correct date format? or am I missing something out?

Thanks in advance for your help

Brett


You'll need to parse each value as a date before comparing:

if (Date.parse(fromDate) > Date.parse(toDate)) {
    alert("Specified date falls outside of the date range");
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜