How do I validate an array of form elements, for a valid date value
I want to prevent the form from submitting if there is an invalid date value
I have an array of date inputs with random values....
Not every field has to have a value, but if it does-it has to be a valid date...
<input name="job_date_completed[521]" type="text" value="10/10/2012" >
<input name="job_date_completed[528]" type="text" value="10/10/2012" id="date521" enabled="" >
I already have this function:
function ValidateDate(dtValue)
{
var dtRegex = new RegExp(/\b\d{1,2}[\/-]\d{1,2}[\/-]\d{4}\b/);
return dtRegex.test(dtValue);
}