View Single Post
Old 03-18-2009, 05:39 AM   #7 (permalink)
Talking BlackBerry Encyclopedia
Join Date: Apr 2008
Location: Germany, BW
Model: -
Carrier: -
Posts: 310
Post Thanks: 0
Thanked 0 Times in 0 Posts

OK, I see what you mean. Could reproduce it on a Bold device. This is a bug for me. The state/value of the checkbox is set AFTER the onClick action is executed, that's why you get wrong value if you checks the state of the chkSelectAll checkbox.
It seems to be fixed in 4.6.1

you could use a global variable to save the state a an additional hidden field in your form.

here is the version with toggling the global variable:
check/uncheck all


    var allChecked = false;

    function chkAllFunc(frm)
	allChecked = !allChecked;

       for(i=0; i<frm.elements.length; i++)
           var alertText = "called";                
            if(frm.elements[i].type == "checkbox"){

<form name="frmStatus">
    <input type="checkbox" name="list" value="1">1<br>
    <input type="checkbox" name="list" value="2">2<br>
    <input type="checkbox" name="list" value="3">3<br>
    <input type="checkbox" name="list" value="4">4<br>
    <input type="checkbox" name="list" value="5">5<br>
    <input type="checkbox" name="chkSelectAll" value="Check All" onClick="chkAllFunc(this.form);"> All
Blessed is the end user who expects nothing, for he/she will not be disappointed. (Franklin's Rule)

Last edited by Ivanov : 03-18-2009 at 05:40 AM.
Offline   Reply With Quote