javascript validation
<p>I am facing some problem in javascript validation 
condition is I need to update the date in a textbox and that date should'nt be backdated from the applicationdate, if I update the date as backdate from the applicationdate ill get the alert masg E-CLRDATELTTXNDATE.issue is if I click on any text box linked to that date textbox this alert is keep on repeating even if I click on ok button of this alert window.</p>

<pre><code>   function txtClearingDate_blur(i) {
        i--;
        if (document.frmPaymentClearing.hidTxnCount.value == 1) {
        if (("" + document.frmPaymentClearing.txtClearingDate.value).length &gt; 0) {
                    if (!isDate(document.frmPaymentClearing.txtClearingDate.value,document.frmPaymentClearing.hidShortDateFormat.value,document.frmPaymentClearing.hidDateSeperator.value)) {
document.frmPaymentClearing.txtClearingDate.focus();return;
                         } else {
                                i++;
                    if (isClearingDateGreaterThanAppdate(i--)) {
                                        document.frmPaymentClearing.txtClearingDate.focus();
                        GetAlertMessage("E-CLRDATE","E","","","");
                     }
                                 i++;
                    if (!isClearingDateGreaterThanTxnDate(i--)) {
                        document.frmPaymentClearing.txtClearingDate().focus();

                        GetAlertMessage("E-CLRDATELTTXNDATE","E","","","");

                    }


                    }
                }
            } else {
                if (("" + document.frmPaymentClearing.txtClearingDate[i].value).length &gt; 0) {
                    if (!isDate(document.frmPaymentClearing.txtClearingDate[i].value,document.frmPaymentClearing.hidShortDateFormat.value,document.frmPaymentClearing.hidDateSeperator.value)) {
                                       document.frmPaymentClearing.txtClearingDate[i].focus();return;
                                } else {
                                        i++;
                    if (isClearingDateGreaterThanAppdate(i--)) {
                                                   document.frmPaymentClearing.txtClearingDate[i].focus();
                               GetAlertMessage("E-CLRDATE","E","","","");
                    }

                    i++;
                    if (!isClearingDateGreaterThanTxnDate(i--)) {
                        document.frmPaymentClearing.txtClearingDate(i).focus();
                        GetAlertMessage("E-CLRDATELTTXNDATE","E","","","");
                        return;
                    }

                    }

                }

            }
        }
</code></pre>

<p><strong>HTML:</strong></p>

<pre><code>&lt;%If strFormState = "NEXTDISPLAY" Then%&gt;
&lt;INPUT type="text" name="txtClearingDate" size=10 value='&lt;%=FormatDateTime(IIF(IsDBNull(rstPaymentRecs.fields.Item("ClearingDate").Value), Nothing, rstPaymentRecs.fields.Item("ClearingDate").Value), 2)%&gt;' onblur="txtClearingDate_blur((&lt;%=i%&gt;))"&gt;
&lt;INPUT type="hidden" name="hidTxnDate" size=10 value='&lt;%=FormatDateTime(IIF(IsDBNull(rstPaymentRecs.fields.Item("TransactionDate").Value), Nothing, rstPaymentRecs.fields.Item("TransactionDate").Value), 2)%&gt;'"&gt;
&lt;%Else%&gt;
&lt;INPUT type="text" name="txtClearingDate" size=10 value='&lt;%=FormatDateTime(objSecurityContext.Appdate, 2)%&gt;' onblur="txtClearingDate_blur(&lt;%=i%&gt;)"&gt;
&lt;INPUT type="hidden" name="hidTxnDate" size=10 value='&lt;%=FormatDateTime(IIF(IsDBNull(rstPaymentRecs.fields.Item("TransactionDate").Value), Nothing, rstPaymentRecs.fields.Item("TransactionDate").Value), 2)%&gt;'"&gt;
&lt;%End If%&gt;
</code></pre>
