Hi..
Please could someone help me. I want to be able to make a user fill in both of these selection lists, and if not .. the user would be prompted to, before the form can be sent.
Im only able to validate the first list, unsure on how to add the second list in.
Here is my code.
----------------------------------------------------------------------------------------
<html>
<head>
<title></title>
<script language="JavaScript">
<!--
function checkList(selection) {
if (selection.length == 0) {
window.alert("Make a selection.");
return false;
}
return true;
}
function checkForm(formObj) {
return checkList(formObj.myField.value);
}
The quickest way to validate a form is to iterate the elements collection and use a switch statement to choose validation criteria by name, id, class, tagName, type or whatever, depending on how specific your validation needs to get.
Just the other day, I was thinking ... about this tiny ad: