You need to sign in to do that
Don't have an account?
lakshman.matti
Enabling Button when check box is checked.
Hi Everyone,
I have a button initially, it is disable(i.e not able to click.).
i want to enable it when if any one of the check box is checked.
here is my check box code.and button code
<apex:column headerValue="Select" style="text-align: center">
<apex:inputCheckbox id="isCheckBox" style="opacity:{!w2.isPartOrderabilityStatusCode};" value="{!w2.isCheckBox}" >
<apex:actionSupport event="onclick" action="{!checkBoxStaus}" reRender="pb2"/>
</apex:inputCheckBox>
</apex:column>
<apex:commandButton value="Add Selected" action="{!selectRecords}" id="sparebtn" reRender="frm">
<apex:actionSupport event="onclick" rerender="resultsBlock" status="statusSaveTrip"/>
</apex:commandButton>
Thanks
Lakshminarayana
I have a button initially, it is disable(i.e not able to click.).
i want to enable it when if any one of the check box is checked.
here is my check box code.and button code
<apex:column headerValue="Select" style="text-align: center">
<apex:inputCheckbox id="isCheckBox" style="opacity:{!w2.isPartOrderabilityStatusCode};" value="{!w2.isCheckBox}" >
<apex:actionSupport event="onclick" action="{!checkBoxStaus}" reRender="pb2"/>
</apex:inputCheckBox>
</apex:column>
<apex:commandButton value="Add Selected" action="{!selectRecords}" id="sparebtn" reRender="frm">
<apex:actionSupport event="onclick" rerender="resultsBlock" status="statusSaveTrip"/>
</apex:commandButton>
Thanks
Lakshminarayana
For that you will need to change a variable in the controller that manage the visibility.
This variable need to be set to true when any of the checkbox its selected.
Then using a rerender you can display or not the button based on this variable.
Small demo, I will sleep the columns and output panel, but form the logic you had there is should be a component with id pb2 that will be rerendered when checkbox selected.
The class (several variables missing but you should get the idea)
Public class Democlass{
public boolean isButtonValid{get;set;}
public pagereference checkBoxStaus() {
// add more logic here like validate all checkboxes to see if any it's checked
isButtonValid = true;
return null;
}
}
I hope it helps, let me know how it goes,
Bill