You need to sign in to do that
Don't have an account?
Ganguly
Select All Check Box not functioning in IE9
Hi All,
I have implemented the Select All checkbox functionality in a VF Page. This functionality works fine with all browsers EXCEPT IE9.
In IE9 the master checkbox, if clicked, doesnt select all the child check boxes.
The Strange thing is that, there is another page which i have built which is exactly same as this page, but the multiselect functionality works fine for that page in IE9 also.
I am surprised with this strange behaviour of IE9 for different pages.
Any guidance in this perspective will be very much helpful for me.
Thanks in Advance.
Regards,
Kaushik
Hi Ganguly,
Can you post the relevant VF/Apex code? And do you use any Javascript to set the checkboxes at all?
Hi J&A_Dev,
Yes, I am Using Javascript for selecting all check boxes. Below is the Java script snippet:
//Implementation for string endsWith function
if (!String.prototype.endsWith) {
String.prototype.endsWith = function(suffix) {
var startPos = this.length - suffix.length;
if (startPos < 0) {
return false;
}
return (this.lastIndexOf(suffix, startPos) == startPos);
};
}
//checks / unchecks all checkboxes in the table
function jsCheckAll(masterCheckbox){
var frm = document.getElementById('pageId:formId');
for (i = 0; i < frm.elements.length; i++){
if (frm.elements[i].name.endsWith('chk')) {
frm.elements[i].checked = masterCheckbox.checked;
}
}
}
//checks / unchecks the master checkbox
function jsSetChecked(childCheckbox){
//get the form element
var frm = document.getElementById('pageId:formId');
//get the master checkbox element
var masterCheckbox;
for (i = 0; i < frm.elements.length; i++){
if (frm.elements[i].name.endsWith('master')){
masterCheckbox = frm.elements[i];
break;
}
}
//check / uncheck the master checkbox
var allChecked = true;
for (i = 0; i < frm.elements.length; i++){
if (frm.elements[i].name.endsWith('chk')) {
if(!frm.elements[i].checked){
allChecked = false;
break;
}
}
}
masterCheckbox.checked = allChecked;
}
function jsUncheckMaster(){
//get the form element
var frm = document.getElementById('pageId:formId');
//get the master checkbox element
var masterCheckbox = null;
for (i = 0; i < frm.elements.length; i++){
if (frm.elements[i].name.endsWith('master')){
masterCheckbox = frm.elements[i];
masterCheckbox.checked = false;
break;
}
}
}
</script>
And Below is the VF Code snippet where I am calling the JS:
<apex:pageBlockTable value="{!lstuserWrapper}" var="userRecord" id="contable" rendered="{!searchListFlag}" width="100%" >
<apex:column width="1%">
<apex:facet name="header">
<apex:inputCheckbox id="master" onclick="return jsCheckAll(this);"/>
</apex:facet>
<apex:inputCheckbox id="chk" value="{!userRecord.isselected}" onclick="return jsSetChecked(this);"/>
</apex:column>
Regards,
Kaushik
Hmm, this seems to be related to how IE9 interprets JS script. Try replacing all instances of:
to:
See if that makes any difference.
Hmm.... Did it... Bt No Success.
Actually there is another page which also has the very same functionality. That page is working fine in IE9.
I am finding it strange as to why this page is not responding properly in IE9