...

View Full Version : Making Checkbox selected after returning java script.



anilreddy76
08-30-2007, 03:21 PM
Hi,

I'm having the following javascript code,after all the checkboxes are unslected,i'll display the alert to user saying that "Atleast one must be selected",but the checkbox is becoimng unselected,how to make check box selected after throwing this alert.

var checkSelected = false;
for (i = 0; i < planForm.locationOptions.length; i++) {
if (planForm.locationOptions[i].checked) {
checkSelected = true
document.planForm.action='refreshPlanView.do';document.planForm.submit();
document.getElementById("refreshing").style.display="block";
}
}
if (!checkSelected) {
alert("At least ONE Location must be selected!");
return false;
}
return true;
}

Thanks,
Anil

shyam
08-30-2007, 03:30 PM
if (!checkSelected) {
alert("At least ONE Location must be selected!");
setSelected(urCheckbox);
return false;
}

anilreddy76
08-30-2007, 04:12 PM
Hi,

Thanks for ur reply.

I've used setSelected(locationOptions[i]);

but it is not setting the checkbox as selected after throwing the alert,it is unchecking the checkbox.

please advise.

Thanks,
Anil



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum