I have a requirement in which a Text field has to be made editable or rendered when a check box is checked, how can I achieve this?
Here's a strictly Visualforce code sample that will work as well:
<apex:pageBlock id="theBlock">
<apex:inputCheckbox value="{!theSObject.CheckBox__c}">
<apex:actionSupport event="onchange" rerender="theBlock"/>
</apex:inputCheckbox>
<apex:inputText value="{!theSObject.TextField__c}" disabled="false" rendered="{!(theSObject.CheckBox__c == true)}"/>
<apex:inputText value="{!theSObject.TextField__c}" disabled="true" rendered="{!(theSObject.CheckBox__c != true)}"/>
<!-- Or to simply have a field that appears only when the box is checked -->
<apex:inputText value="{!theSObject.TextField__c}" rendered="{!(theSObject.CheckBox__c == true)}"/>
</apex:pageBlock>
In addition to this, you can add an action in the action support if you wish to do further processing in Apex, like this:
<apex:actionSupport event="onchange" action="{!myMethod}" rerender="theBlock"/>
Hope that helps