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:outputText value={!Object__c.ExampleField__c}>

Now am adding one checkbox field and when this checkbox is checked, the outputtext field should become editable.

          <apex:inputText value="{!Object__c.CheckboxField__c}"

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

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

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


1 Answer 1


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:inputText value="{!Object__c.CheckboxField__c}">
        <apex:actionSupport event="onchange" 
            rerender="editableBlock" />

<!-- below field editable when above checkbox is checked -->
<apex:pageblocksection id="editableBlock">    
    <apex:outputText value="{!Object__c.ExampleField__c}" 
    <apex:inputText value="{!Object__c.ExampleField__c}" 
  • Thanks for your answer. I'll mark this as answer. Once I did like this the formatting is collapsed. Can we do anything to bring back the default formatting?.
    – Prince
    Feb 7, 2017 at 9:47
  • I am not sure what you mean by formatting, unable to visualize!
    – Raul
    Feb 7, 2017 at 9:52
  • I have pageblocksection inside another pageblocksection so the default style formatting of the Examplefield__c is collapsing. Is there any workaround for this to bring back the default stying?.
    – Prince
    Feb 7, 2017 at 12:55
  • A pageblock section should never be inside another one, maybe render them conditionally
    – Raul
    Feb 7, 2017 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.