1 alert("Testing my code... ");
2 var i = 0;
3 while( i<MAXELEM )
4 {
5 alert( "item " + i + ": " + qform.elements[i].value );
6 i = i + 1;
7 }
function checkInput( qform )
{
...
}
and put the 7 lines of code into the "..." of this function.
make sure you change FORMNAME to the name you used in your form

checkSyntax( qform.elements[ DEP_DATE_INDEX ].value );where DEP_DATE_INDEX is the number of the nth element corresponding to your departure date form element. then, your syntax function starts as follows:
// ARG: datestring = dd/mm/yyyy
// 01 34 6789 -- index positions
function checkSyntax( datestring )
{
var baditems = 0;
var len = datestring.length;
// step 1. go through each character of the string
// a. if it is in position 2 or 5, check if it is a slash
// b. if it is in any other position, check if it is a number
...
}
checkSemantics( datestring );then, your function that checks for real dates starts as follows:
// ARG: datestring = dd/mm/yyyy
// 01 34 6789 -- index positions
function checkSemantics( datestring )
{
// step 1. extract dd from datestring
...
// step 2. extract mm from datestring
...
// step 3. extract yyyy from datestring
...
// step 4. check valid year (2005 or 2006)
...
// step 5. check valid month (1 to 12)
...
// step 6. check valid day depending on the month (up to 30, 28, or 31)
...
}
| test case | expected result | actual result |
| abcdefg | no | ... |
| 01122005 | no | ... |
| 01/01/2005 | ... | ... |
| 01/25/04 | ... | ... |
| 2/11/2006 | ... | ... |
| 11/02/2006 | ... | ... |
| 02/11/2006 | ... | ... |
| 02/01/2006 | ... | ... |
| 00/00/2006 | ... | ... |
| 30/02/2006 | ... | ... |
| 30/09/2006 | ... | ... |
| 31/09/2006 | ... | ... |