>> Sorry this really should have been a reply to my previous message "Validation Script won't work in Mozilla! Why?"
Hi guys thanks for the help with the previous problem... the first 2 validation methods now work in Mozilla fine! However I am still having trouble with the last one, which checks the values of the Start and End Dates. The code for the combo box is this:
And the Javascript now looks like this:
Startweek must always be less then or equal to endweek...
The validation works fine, until I select a value in Starweek that is greater than 1 and a value in Endweek that is greater than 10.
For example - 1 Start and 15 End validates fine (No Error), as does 6 Start and 3 End (Error Message is Shown)...
2 Start and 11 End will generate the Error Message even though it should not....
What am I missing here?
Thanks very much!
Hi guys thanks for the help with the previous problem... the first 2 validation methods now work in Mozilla fine! However I am still having trouble with the last one, which checks the values of the Start and End Dates. The code for the combo box is this:
Code:
<br></tr><tr><td>Start Week: </td><td><select name="startweek" size=1><br> <option selected value=1>1 <option value=2>2 <option value=3>3 <option value=4>4 <option value=5>5 <option value=6>6 <option value=7>7 <option value=8>8 <option value=9>9 <option value=10>10 <option value=11>11 <option value=12>12 <option value=13>13 <option value=14>14 <option value=15>15</select> <br></tr><tr><td>End Week: </td><td><select name="endweek" size=1><br> <option value=1>1 <option value=2>2 <option value=3>3 <option value=4>4 <option value=5>5 <option value=6>6 <option value=7>7 <option value=8>8 <option value=9>9 <option value=10>10 <option value=11>11 <option value=12>12 <option value=13>13 <option value=14>14 <option selected value=15>15</select> <br></tr><tr><td>Day of Week: </td><td><select name="day" size=1><br>
Code:
function validate(objForm) { return checkProgramme(objForm) && checkCapacity(objForm) && checkWeeks(objForm); } function checkProgramme(objForm) { if (objForm.programme.value != "select") { return true; } else { alert('You must select a programme.'); return false; } } function checkCapacity(objForm) { if ((objForm.capacity.value >0) && (objForm.capacity.value <501)) { return true; } else { alert('Capacity must be between 1 and 500.'); return false; } } function checkWeeks(objForm) { if (objForm.startweek.value <= objForm.endweek.value) { return true; } else { alert('The end week must be later than the start week.'); return false; } }
The validation works fine, until I select a value in Starweek that is greater than 1 and a value in Endweek that is greater than 10.
For example - 1 Start and 15 End validates fine (No Error), as does 6 Start and 3 End (Error Message is Shown)...
2 Start and 11 End will generate the Error Message even though it should not....
What am I missing here?
Thanks very much!
Comment