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>
How can we apply the tech to dynamic element? For instance, when we lookup account, the related contact will be showed below, so how can we apply the tech to the dynamic checkbox?
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDelete