function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
asish1989asish1989 

Displaying Controlling picklist and dependant picklist on a different output panel

HI

I have one dependant picklist and one controlling picklist of position object, I want to display one picklist in one output panel and another in other panel by clicking next button, so please anyone can suggest me how will I do that?

This is my page

<apex:page controller="testtt">
<apex:form>
    
  <apex:outputPanel rendered="{!visible == false}">
      <!--<apex:inputField value="{!pos.Functional_Area__c}" id="test" onchange="confirmDisbaled('{!$component.test}');"/>-->
      <apex:inputField value="{!pos.Functional_Area__c}" id="test" />
       
      <apex:commandButton value="Next" action="{!next}"/>
  </apex:outputPanel>
 
  <apex:outputPanel rendered="{!visible == true}">
      
      <apex:inputField value="{!pos.Job_Level__c}" />   
  </apex:outputPanel>
 
</apex:form>
</apex:page>

I want to display corresponding joblevel which are under Function Area of postion picklist.

My controller is

public class testtt{

    public Position__c pos{get; set; }
    public Boolean visible{get;set;}
    public testtt(){
        pos = new Position__c();
        visible = false;
    }
    public void next(){
      
        visible = true;
    }
}

 

Please suggest me some idea as soon as possible..

 

Thanks

Jeff MayJeff May

I think as long as both apex:input fields are related to the same object, as soon as the controlling picklist value is selected for that object, when you render the second panel, the dependent picklist will contrain the correct choices.  Depending on how your VF page is constructed, you may need to rerender a section of your page.