+ Start a Discussion
Jonathan WallaceJonathan Wallace 

Change conditional input fields to output fields upon checking box

Hello, I'm a visualforce newbie, so be kind :). My org wanted to have conditional fields appear based on a picklist choice. I was able to accomplish this,  however I want to change the checkboxes that appear to outputfields after they have either been checked or after the quick save button has been clicked. I've tried a few different options and I haven't been able to accomplish this. I'm using the opportunity standard controller.
here is my code:

<apex:page standardController="opportunity">
   <apex:form >
   <apex:pageBlock >     
   <apex:pageblockButtons location="bottom">
   <apex:commandButton action="{!QuickSave}" value="Quick Save" rendered="{!opportunity.type = 'Program Improvement'}"/>
  <apex:pageBlockSection columns="1" collapsible="false" >
  <apex:inputField value="{!opportunity.type}">
  <apex:actionSupport event="onchange"  action="{!quicksave}" />
  <apex:inputField value="{!opportunity.Program_Improvement_Expansion__c}" rendered="{!opportunity.type = 'Program Improvement' }"/>
  <apex:inputField value="{!opportunity.Program_Improvement_Policies_Practices__c}" rendered="{!opportunity.type = 'Program Improvement'}"/>
  <apex:inputField value="{!opportunity.Program_Improvement_Skills_Training__c}" rendered="{!opportunity.type = 'Program Improvement'}"/>
  <apex:inputField value="{!opportunity.Program_Improvement_Equipment__c}" rendered="{!opportunity.type = 'Program Improvement'}"/>
deepak balur 19deepak balur 19
I tried your code in my sandbox and I was able to get the checkboxes displayed. So If I select say Program Improvement then it displayed the checkbox for me an as soon as I selected another checkbox a new checkbox appeared but the first one disappeared. If you want the first one to exist as a outfield then you will need to put apex:column tags as well which will display them as output, you will need action method on the input fields to display the output tags. Makes sense?
Jonathan WallaceJonathan Wallace
I think I may not be explaining it that well. There is only one selection on the multi picklist that has checkboxes associated with it. In this case Program Improvement is the only "checkbox" that has children checkboxes. What I wasn't sure how to do, is once the checkboxes under program improvement were selected, how do you get them to change to output fields? make sense?