function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ravi1234.ax1565ravi1234.ax1565 

check boxes

hello group,

 

      i hav a few records in pageblock table, in that i placed check boxes,

 

by using the below code

  

<script>
function checkAll(cb){
var inputElem = document.getElementsByTagName("input");
for(var i=0; i<inputElem.length; i++){
if(inputElem[i].id.indexOf("checkedone")!=-1)
inputElem[i].checked = cb.checked;

}
}
</script>

--------------------------------------------------------------------         

  <apex:facet name="header">
  <apex:inputCheckbox >
  <apex:actionSupport event="onclick" action="{!deleteselected}" onsubmit="checkAll(this)" reRender="Selected__pbs"/>
  </apex:inputCheckbox>
  </apex:facet>
  <apex:inputCheckbox id="checkedone">
  <apex:actionSupport event="onclick" action="{!deleteselected}" reRender="Selected__pbs"/>
  </apex:inputCheckbox>
  </apex:column>

 

iam getting when i click a check box in a table, all check boxes associated with records are getting check........

upto now iam happy....

 

my requirement is .....

 

if i uncheck any checkbox associte with any single record automatically the check box in column header (placed in the facet) should get uncheck.........

 

usually we can observe in  inbox in our mails.....

how can i achieve my requirement can any one pls correct my code?

 

thanks for giving reply(in advance) 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
harsha__charsha__c

Hi Ravi,

 

for this you can try the followed script

function UncheckParent(obj) {
    var isUnchecked = obj.checked;
    if (isUnchecked == false) {
        //Uncheck the header
            }
        }

 call this js function on click of the individual checkbox

All Answers

harsha__charsha__c

Hi Ravi,

 

for this you can try the followed script

function UncheckParent(obj) {
    var isUnchecked = obj.checked;
    if (isUnchecked == false) {
        //Uncheck the header
            }
        }

 call this js function on click of the individual checkbox

This was selected as the best answer
ravi1234.ax1565ravi1234.ax1565

hi harsha,

 

        can u pls eloberate ur code i.e, hot to call js function on click of the individual checkbox.

 

          beceause iam new to salesforce

     

              thanks for giving reply

harsha__charsha__c

Hi Ravi,

 

It is like

 

<apex:inputCheckBox value="{!someValue}" onclick="functionName(this)"/>