You need to sign in to do that
Don't have an account?

how to disable the checkbox field
i have 2 checkbox fields in pageblock table one is present another one is absent like below
<apex:inputCheckbox value="{!s.present__c}" id="ch">
<apex:inputCheckbox value="{!s.absent__c}" id="ch1">
if i check the one of the checkbox in present field beside absent field checkbox want to disable how to write the code please send me sample code
Hi Laxmi try this code
<apex:page >
<apex:form >
<script>
function confirmDisbaled(ifchecked, id1 ,id2) {
document.getElementById(id1).disabled= ifchecked;
document.getElementById(id2).disabled= ifchecked;
}
</script>
<apex:pageBlock >
<apex:actionRegion >
<apex:outputPanel id="panel1">
<apex:pageBlockSection title="PST" id="PST" columns="1">
<apex:inputCheckbox label="present" id="gbl" onchange="return confirmDisbaled(this.checked, '{!$Component.lcl}','{!$Component.cntry}');"/>
<apex:inputCheckbox label="absent" id="lcl" onchange="return confirmDisbaled(this.checked, '{!$Component.gbl}','{!$Component.cntry}');"/>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:actionRegion>
</apex:pageBlock>
</apex:form>
</apex:page>
if it is helpful plz make it as solution for others it may benfit
Lakshmi
Sounds like you should use a Radio Set instead if you only want the selection to be mutually exclusive, but you can go with the checkboxes if you prefer that.
Check out the apex:selectRadio from the component reference.
Richard
Hi Laxmi try this code
<apex:page >
<apex:form >
<script>
function confirmDisbaled(ifchecked, id1 ,id2) {
document.getElementById(id1).disabled= ifchecked;
document.getElementById(id2).disabled= ifchecked;
}
</script>
<apex:pageBlock >
<apex:actionRegion >
<apex:outputPanel id="panel1">
<apex:pageBlockSection title="PST" id="PST" columns="1">
<apex:inputCheckbox label="present" id="gbl" onchange="return confirmDisbaled(this.checked, '{!$Component.lcl}','{!$Component.cntry}');"/>
<apex:inputCheckbox label="absent" id="lcl" onchange="return confirmDisbaled(this.checked, '{!$Component.gbl}','{!$Component.cntry}');"/>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:actionRegion>
</apex:pageBlock>
</apex:form>
</apex:page>
Thanks
Ashok Kumr.M