You need to sign in to do that
Don't have an account?
Suresh Radha 1
How to access VF page elements from custom button script?
Hi All,
Need help!!
I am trying to access VisualForce Page elements(Checkbox) from Case detail Page using Custom button javascript. But document.getElementsByClassName('chkSelected') does not get recognized. Any help is highly appreciated.. Thanks!!
Need help!!
I am trying to access VisualForce Page elements(Checkbox) from Case detail Page using Custom button javascript. But document.getElementsByClassName('chkSelected') does not get recognized. Any help is highly appreciated.. Thanks!!
If you want access the DOM input elements by using class name, you need to use index value.
Thanks
Boni
function isSelected(){
var checkedValue = null;
var inputElements = document.getElementsByClassName('chkSelected');
for(var i=0; inputElements[i]; ++i){
if(inputElements[i].checked){
checkedValue = inputElements[i].value;
return true;
break;
}
}
Below is section of VF page
<apex:outputPanel layout="block" style="overflow:auto;width:1550px;height:250px" >
<apex:pageBlockTable value="{!products}" var="c" id="ProductList" >
<apex:column >
<apex:inputCheckbox value="{!c.con.id}" styleClass="chkSelected" id="sProd" />
</apex:column>
<apex:column value="{!c.con.Product__c}" />
<apex:column value="{!c.con.Shipping_Address_Details__c}" />
Can you say your requirement clearly?