1

I am facing an issue where a dependent picklist on a vf page is appearing as disabled in a apex tab, even with its controlling field editable on the page (and selectable). I am finding that with multiple tabs on the screen the dependant picklists are disabled. With a single tab they are displayed. The underlying record is correct (it has the correct recordtype id & field values) & the user I am testing with is a sys admin. Weirdly writing out the value of those dependant picklists (e.g. in an output label) shows that if they had a value the correct one is displayed within the label.

The page I am working on is extremely complex so what I'm really looking for is guidance on whether someone else done something similar successfully.

Note - Simplified Code for illustrative purposes

Page:

<apex:page id="testabc" standardController="Account" extensions="example1, example2" sidebar="true" showheader="true" title="test">
    <apex:pageBlock id="testpage" title="sample">           
    <apex:form id="testForm">
      <apex:outputpanel id="testPanel">
         <apex:tabPanel switchType="ajax" value="{!selectedTab}" id="tabPanel" activeTabClass="activeTab" inactiveTabClass="inactiveTab">
              <apex:tab label="tab1" name="tab1"> 
                 <apex:inputField value={!test.controllingField} /> 
                 <apex:inputField value="{!test.dependantField}" /> 
              </apex:tab> 
              <apex:tab label="tab2" name="tab2"> 
                 <apex:inputField value="{!test.controllingField}"/> 
                 <apex:inputField value="{!test.dependantField}" />
              </apex:tab> 
      </apex:outputPanel>
    </apex:form>
 </apex:pageBlock> 

Upon loading the dependant picklist is unselectable. Even more odd is if I add a <apex:ouputField value="{!test.dependantField}" /> within "tab1" it is editable on load but upon switching tabs it again is unselectable.

EDIT 1: When the controlling field is changed the dependent field is being successfully re-rendered (without errors in logs or UI) but is still unselectable.

1 Answer 1

0

This turned out to be because the controlling field was being displayed on tab2. Even though tab2 was not selected it seemed to be picking up the wrong controlling field value (each tab was a record with a different recordtype). After much trial & error this was solved by not rendering the controlling field on tab2 when tab1 was selected and vice versa.

My guess (could be totally wrong) is that although the current record had been changed correctly and the fields reRendered on tab change, there was some blackbox js for the controlling/dependent fields that got muddled by the two controlling fields within the tab panel.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .