I have the below code and validation to check if the dates being entered are valid. I need to add some simple javascript validation to check whether the 'expiry' date is before the 'review by' date. If expiry date is a date before review date then ok , if not give an error alert box. thanks for any help.
I'm thinking I can compare the two strings and see if one is < than the other but not sure whats the best way to do this.
<tr>
<td class="SubHeader" height="5%">Review</td>
</tr>
<tr>
<td class="Label">Review By</td>
<td>
<input class="amdInputText" type="text" id="guaranteereviewbydate" value="">
<xsl:attribute name="value"><xsl:value-of select="guaranteereviewbydate"/></xsl:attribute>
</input>
</td>
</tr>
<tr>
<td class="Label">Expire On</td>
<td><input class="amdInputText" type="text" id="guaranteeexpireondate" value="">
<xsl:attribute name="value"><xsl:value-of select="guaranteeexpireondate"/></xsl:attribute>
</input>
</td>
</tr>
<xsl:if test="count(../bankguaranteedata) > '1'">
else if(!validateDate(document.lending.guaranteereviewbydate[<xsl:value-of select="@id"/>].value)){alert("Please enter a valid review by date. The date must be of the format dd/mm/yyyy");document.lending.guaranteereviewbydate[<xsl:value-of select="@id"/>].focus();return false;}
else if(!validateDateExpireOn(document.lending.guaranteeexpireondate[<xsl:value-of select="@id"/>].value)){alert("Please enter a valid expire on date. The date must be of the format dd/mm/yyyy");document.lending.guaranteeexpireondate[<xsl:value-of select="@id"/>].focus();return false;}
</xsl:if>
<xsl:if test="count(../bankguaranteedata) = '1'">
else if(!validateDate(document.lending.guaranteereviewbydate.value)){alert("Please enter a valid review by date. The date must be of the format dd/mm/yyyy");document.lending.guaranteereviewbydate.focus();return false;}
else if(!validateDateExpireOn(document.lending.guaranteeexpireondate.value)){alert("Please enter a valid expire on date. The date must be of the format dd/mm/yyyy");document.lending.guaranteeexpireondate.focus();return false;}
</xsl:if>