Q:

Make OutputField Editable Per Condition

I have outputfield to show the value of the field in Edit Visualforce page. I want to make this outputfield editable when checkbox field is checked
<apex:pageblocksection>    
      <apex:outputText value={!Object__c.ExampleField__c}>
</apex:pageblocksection>

Now am adding one checkbox field and when this checkbox is checked, the outputtext field should become editable.
    <apex:pageblocksection>
          <apex:inputText value="{!Object__c.CheckboxField__c}"
    </apex:pageblocksection>

//Make the below field editable when above checkbox is checked

    <apex:pageblocksection>    
          <apex:outputText value="{!Object__c.ExampleField__c}">
    </apex:pageblocksection>

I have tried with having inputtext and rendered="{!IF(Object__c.CheckboxField__c == true, true, false)}". But it is not working as expected.
Thanks!!

A:

I would use apex:inputCheckbox (instead of inputText) with action support, rerender the block containing input and output fields rendered conditionally.
Following is psuedo code:
<apex:pageblocksection>
    <apex:inputText value="{!Object__c.CheckboxField__c}">
        <apex:actionSupport event="onchange" 
            rerender="editableBlock" />
    </apex:inputText>
</apex:pageblocksection>

<!-- below field editable when above checkbox is checked -->
<apex:pageblocksection id="editableBlock">    
    <apex:outputText value="{!Object__c.ExampleField__c}" 
        rendered="{!NOT(Object__c.CheckboxField__c)}">
    <apex:inputText value="{!Object__c.ExampleField__c}" 
        rendered="{!Object__c.CheckboxField__c}">
</apex:pageblocksection>

