title: Validate End date is greater than start date in CRM 2015
body: <p>I want to validate <code>Start date</code> and <code>End date</code> how should I write in web resource?</p>
  
  <p>I have tried some code but it doesn't work. The function is continuously repeating after some time. But it should be stop once executed.</p>
  
  <p>Please help me on this.</p>
  
  <pre class="lang-js prettyprint-override"><code>function ValidateEndDate(econtext) 
  {
    var sdate = Xrm.Page.getAttribute("new_startdate");
    var edate = Xrm.Page.getAttribute("new_enddate");
    var eventArgs = econtext.getEventArgs();
  
    if (sdate.getValue() &gt; edate.getValue())
    {
      alert("End date should be greater than");
  
      sdate.setValue(null);
      eventArgs.preventDefault();
    }
  }
  </code></pre>