BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/)
-   Developer Forum (http://www.blackberryforums.com/developer-forum/)
-   -   Select all check boxes issue with Blackberry 9000 bold (http://www.blackberryforums.com/developer-forum/180980-select-all-check-boxes-issue-blackberry-9000-bold.html)

srihari83 03-13-2009 06:34 AM

Select all check boxes issue with Blackberry 9000 bold
 
Hi Friends,

We are working on one of the Blackberry requirements.

Brief description :
Developing browser based application for Blackberry 9000 bold
which involves the selection of multiple check boxes and select all check box(java scripti is enabled on the Blackberry browser)

when we select 'select all check box' is de selecting the already selected chckboxes (individual) and its selecting when we de select the 'select all check box' . This is cross checked on BB bold 9000 simulator (given by RIM).

Same is behaving fine with the 8800 simulator.

Any suggestion on usage of 'eval' method in javascript for Blackberry browser functionality.

Appreciate your quick response.:smile:

Thanks,
Sri.

srihari83 03-16-2009 04:51 AM

Hi Friends,

Pls. let me know the solution for the above problem...it is very urgent for me...I am sick of this issue...

Ivanov 03-16-2009 04:54 AM

it might be helpful if you show us your code

srihari83 03-17-2009 04:51 AM

Pls. find the below code...!:-(

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

Ivanov 03-17-2009 05:30 AM

seems to work on the curve 8900. Maybe you could provide an url for testing or post the code of the form as well

srihari83 03-17-2009 11:39 PM

1 Attachment(s)
Hi Ivanov,

I have tested this code on 8800 and 9000 Bold simulators. 8800 behaviour is as i expected and 9000bold behaviour is reverse of 8800.i am not sure whether Any configurations i need to change on the device or problem with 9000 bold itself.

pls. find the attached sample.txt file for sample code...

Thanks in Advance...
Sri

Ivanov 03-18-2009 04:39 AM

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:
Code:

<html>
<head>
<title>
check/uncheck all
</title>

</head>
<body>

<SCRIPT LANGUAGE="JavaScript">
    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"){
                if(frm.elements[i].name!="chkSelectAll")
                {           
                    frm.elements[i].checked=allChecked;
                }
              }
      }
      //alert(alertText)
  }
</script>



<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>
    <br>
    <input type="checkbox" name="chkSelectAll" value="Check All" onClick="chkAllFunc(this.form);"> All
    <br>
</form>
</body>
</html>


Ivanov 03-18-2009 04:49 AM

By the way, first I tried the following version below and it worked on the BOLD, but not on the new Curve with 4.6.1. Again a bug for me. There were and are a lot of bugs in RIM'S web/javascript engine. I remember the case on the old Pearl with 4.2.1 when all checkbox values in my form were ignored on POST and it took me days to find out that it was a bug of the browser and not my (complex) ASP code. It was then fixed in the next device software release...

Code:

<html>
<head>
<title>
check/uncheck all
</title>

</head>
<body>

<SCRIPT LANGUAGE="JavaScript">
    var allChecked = false;

    function chkAllFunc(list)
    {
        allChecked = !allChecked;

      for(i=0; i<list.length; i++)
      {
          var alertText = "called";               
          list[i].checked=allChecked;
      }
      //alert(alertText)
  }
</script>



<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>
<br>
<input type="checkbox" name="chkSelectAll" value="Check All"
onClick="chkAllFunc(this.form.list);"> All
<br>
</form>
</body>
</html>


srihari83 03-20-2009 01:49 AM

Hi Ivanov,

Thank you very much...this solution is working fine for me...!


All times are GMT -5. The time now is 08:59 AM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.