Arc
05-30-2003, 05:53 PM
I have a form that dynamically creates an array of checkboxes and assigns numeric values to the checkboxes that correspond to a Database field.
I need to go through all of these checkboxes and check to see if any of them are checked. If none are checked i need to give an error message.
This is what i have but it checks the Value of the checkbox to see if it's empty. I don't know how to see if the check box is checked.
function CheckDelete() {
var form = document.forms[0]
var Valid = false;
for (i = 0; i < form.elements.length ; i++) {
if (form.elements[i].type == "checkbox" && form.elements[i].value != ""){
Valid = true;
break
}
}
if(Valid != true){
alert("You have selected no vehicles to delete.")
}
}
thanks!:D
I need to go through all of these checkboxes and check to see if any of them are checked. If none are checked i need to give an error message.
This is what i have but it checks the Value of the checkbox to see if it's empty. I don't know how to see if the check box is checked.
function CheckDelete() {
var form = document.forms[0]
var Valid = false;
for (i = 0; i < form.elements.length ; i++) {
if (form.elements[i].type == "checkbox" && form.elements[i].value != ""){
Valid = true;
break
}
}
if(Valid != true){
alert("You have selected no vehicles to delete.")
}
}
thanks!:D