Here is the code to select
only one checkbox value in visualforce page by accessing DOM ID
Using the javascript and
onchange event.- <apex:page >
- <apex:form >
- <script>
- function confirmDisbaled(ifchecked, id1 ,id2,id3) {
- document.getElementById(id1).disabled = ifchecked;
- document.getElementById(id2).disabled = ifchecked;
- document.getElementById(id3).disabled = ifchecked;
- }
- </script>
- <apex:pageBlock >
- <apex:actionRegion >
- <apex:outputPanel id="panel1">
- <apex:pageBlockSection title="PST" id="PST">
- <apex:inputCheckbox label="Global" id="gbl" onchange="return confirmDisbaled(this.checked, '{!$Component.lcl}','{!$Component.cntry}');"/>
- <apex:inputCheckbox label="Local" id="lcl" onchange="return confirmDisbaled(this.checked, '{!$Component.gbl}','{!$Component.cntry}');"/>
- <apex:inputCheckbox label="Country" id="cntry" onchange="return confirmDisbaled(this.checked, '{!$Component.lcl}','{!$Component.gbl}');"/>
- </apex:pageBlockSection>
- </apex:outputPanel>
- </apex:actionRegion>
- </apex:pageBlock>
- </apex:form>
- </apex:page>

