0

I have a picklist type outputfield on my visualforce page, i want when i select any value from this field some field will hide as per selected value.

<apex:outputField value="{!oFormobject.C_Item_Married__c }" rendered="{!CONTAINS(sApiName, 'G2C_Item_Married__cN')}">
          <apex:inlineEditSupport showOnEdit="saveButton" event="ondblclick"/>
          <apex:actionSupport event="onchange" reRender="personalInfo" />
</apex:outputField>

Thanks in Advance.

1

As you want to allow users to change picklist options that mean your picklist need to be inputField so user can update it. Here is quick example to how how you can do it with actionSupport

<apex:page controller="ActionSupportDemoCtrl">
<apex:pageBlock id="personalInfo">
<apex:form>

 <apex:pageMessages></apex:pageMessages>
  <apex:inputField value="{!acc.Type}"/>
  <apex:actionSupport event="onchange" reRender="personalInfo" action="{!doSomething}" status="mystatus">

  </apex:actionSupport>
   <br/>
</apex:form>
</apex:pageBlock>  
<apex:actionStatus id="mystatus" startText=" (Working...)" stoptext="Done!"/>  
</apex:page>

Controller

public class ActionSupportDemoCtrl{
 public Account acc{get;set;}
 public ActionSupportDemoCtrl() {
       acc = [Select ID,Type From Account Limit 1];
 }

 public PageReference doSomething() {
     acc.Type ='New value';
     return null;
 }
}

Here is official link of action support doc

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_actionSupport.htm

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.