Forum Moderators: open
<form name="photos" onsubmit="return verify_photos()">
<input type="checkbox" name="deletePhoto1">
<input type="checkbox" name="deletePhoto2">
<input type="checkbox" name="deletePhoto3">
<input type="checkbox" name="deletePhoto4">
<input type="checkbox" name="deletePhoto5">
<input type="checkbox" name="deletePhoto6">
<input type="checkbox" name="deletePhoto7">
<input type="checkbox" name="deletePhoto8">
<input type="checkbox" name="deletePhoto9">
<input type="checkbox" name="deletePhoto10">
</form>
function verify_photos() {
for (h=1;h<=10;h++) {
if (photos["deletePhoto" + h].checked) { //**** Fails here if a cooresponding photo[h] checkbox isn't present. ****//
var answer=confirm("Are you sure you would like to delete the checked photo(s)?");
if (answer) {
} else {
for (i=1;i<=10;i++) {
if (photos["deletePhoto" + i].checked) {
photos["deletePhoto" + i].checked = false;
}
}
return false;
}
}
return true;
}
}
function verify_photos() {
for (h = 1; h <= 10; h++) {
if (photos["deletePhoto" + h] != null &&
photos["deletePhoto" + h].checked) {
var answer = confirm("Are you sure you would like to delete the checked photo(s)?");
if (!answer) {
for (i = 1; i <= 10; i++) {
if (photos["deletePhoto" + i] != null) {
photos["deletePhoto" + i].checked = false;
}
}
return false;
}
return true;
}
}
}
function verify_photos() {
for (h = 1; h <= 10; h++) {
if (photos["deletePhoto" + h] != null &&
photos["deletePhoto" + h].checked) {
var answer = confirm("Are you sure you would like to delete the checked photo(s)?");
if (!answer) {
for (i = 1; i <= 10; i++) {
if (photos["deletePhoto" + i] != null) {
photos["deletePhoto" + i].checked = false;
}
}
return false;
}
return true;
}
}
return true;
}