i’ve been using this form validation but now i need to update it so it only validates an html multiple list selection. i’ve tried to modify it but my attempts just don’t seem to work. can anyone help??
[CODE]<SCRIPT LANGUAGE=”JavaScript”>
<!– Begin form validation
function getCookie(name){
var cname = name + “=”;
var dc = document.cookie;
if (dc.length > 0) {
begin = dc.indexOf(cname);
if (begin != -1) {
begin += cname.length;
end = dc.indexOf(“;”, begin);
if (end == -1) end = dc.length;
return unescape(dc.substring(begin, end));
}
}
return null;
}
function setCookie(name, value) {
var now = new Date();
var then = new Date(now.getTime() + 31536000000);
document.cookie = name + “=” + escape(value) + “; expires=” + then.toGMTString() + “; path=/”;
}
function getInfo(form) {
form.info.value = “Browser Information: ” + navigator.userAgent;
}
function getValue(element) {
var value = getCookie(element.name);
if (value != null) element.value = value;
}
function setValue(element) {
setCookie(element.name, element.value);
}
function fixElement(element, message) {
alert(message);
element.focus();
}
function isMailReady(form) {
var passed = false;
if (form.job_title_id[].selectedIndex ==0) {
fixElement(form.job_title_id[], “SELECTIONS: Please choose a ‘job title’.”);
}
else {
getInfo(form);
passed = true;
}
return passed;
}
// End –>
</SCRIPT>
if it makes any difference… job_title_id[] …is what i’m trying to validate, and the reason i’m using square brackets [] is for php to capture multi selections as an array. and just to let you know …there is no select all option.
cheers!