check box from hell
Posted: Tue Aug 05, 2008 5:20 am
Hi there, my problem is not php-related but javascript. I posted it here anyway hoping that you all might help me with it.
I have a 7 checkboxes, right, named cb1 thru cb7, and I added a code in javascript that sends an alert message if it detected that all checkboxes are not ticked.
here's the code:
==========================================================================================
if (document.frm.cb1.checked == false && document.frm.cb2.checked == false && document.frm.cb3.checked == false && document.frm.cb4.checked == false && document.frm.cb5.checked == false && document.frm.cb6.checked == false && document.frm.cb7.checked == false)
{
alert ("at least one checkbox must be ticked.");
return false;
}
===========================================================================================
The problem is this:
One of the checkbox is ticked but disabled... how can I tell javascript that a checkbox is ticked only disabled?
Javascript seems to treat disabled boxes as if they are unticked.
Thanks in advance for any help you people can give
I have a 7 checkboxes, right, named cb1 thru cb7, and I added a code in javascript that sends an alert message if it detected that all checkboxes are not ticked.
here's the code:
==========================================================================================
if (document.frm.cb1.checked == false && document.frm.cb2.checked == false && document.frm.cb3.checked == false && document.frm.cb4.checked == false && document.frm.cb5.checked == false && document.frm.cb6.checked == false && document.frm.cb7.checked == false)
{
alert ("at least one checkbox must be ticked.");
return false;
}
===========================================================================================
The problem is this:
One of the checkbox is ticked but disabled... how can I tell javascript that a checkbox is ticked only disabled?
Javascript seems to treat disabled boxes as if they are unticked.
Thanks in advance for any help you people can give