cfinput & onValidate
The boss wants to see client-side validation before the form is submitted. I understand this can be done with the onValidate option of the cfinput, but for the life of me I can't get it to work.
Here's the plot: The Return Date (if populated) must be equal to or greater than the Out Date. the "#idx#" is because the entry is looped in a table (currently 56 entries). Here's the pertinent code sections:
<script language="JavaScript" type="text/javascript">
function testdate( ){
alert("Called");
if (document.out_of_office.retdate_#idx# < document.out_of_office.outdate_#idx#)
{
return false;
}
else
{
return true;
}
}
</script>
...
<cfform name="out_of_office" action="index.cfm?fuseaction=update_out_of_office">
...
<cfinput type="text" name="retdate_#idx#" id="retdate_#idx#" maxlenth="10" size="6" value="01/01/0001"
onvalidate="testdate" message="Return Date must be equal to or greater than Out Date."
validateAt="onBlur,onSubmit">
...
I never get the alert box and I always end up in my action page (fuseaction=update_out_of_office). What am I doing wrong?
