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
JayanthJayanth 

Dependent picklist value not getting populated

Hi

 

I am having a peculiar problem. I've created a dependent picklist and am trying to display them both on a visual force page. The controlling picklist displays with its values on the VF page. However, the dependent picklist(multi picklist) although displayed on the page has no values in it.

I've checked the field level security and it seems to be correct.

Also when I remove the dependency between the picklists, the 2 separately display all it values(narrowing my thought to the dependency to be the cause of the problem)

both the picklists are on a custom object with no record type.

The visual force page is attached to a custom controller

Is there any reason for this to occur?

 

am I missing anything while trying to display a picklist on a VF page with a custom controller?

 

VF code:

<apex:inputField id="region" value="{!tempCon.Region__c}"/>
<apex:inputField id="subregion" value="{!tempCon.SubRegion__c}"/>

 

The controller just initialises the variable in the constructor

 

Temp_con__c tempCon = new Temp_con__c();

 

 

Best Answer chosen by Admin (Salesforce Developers) 
mikefitzmikefitz

Recordtype is not required. Sorry I didn't notice you mentioned that in your original post.

It looks like you are doing everything right.

As long as the API >19.0 then it's gotta be a small issue that is being overlooked.
May fire up a test page and controller and see if you can reproduce it with just the one object and two fields


Temp_con__c tempCon = new Temp_con__c();

<apex:inputField value="{!tempCon.Region__c}"/>
<apex:inputField value="{!tempCon.SubRegion__c}"/>

All Answers

Navatar_DbSupNavatar_DbSup

Hi,

 

It may be cause of that dependent picklist has no value selected for each controlling picklist value. So you will have to select the value for dependent picklist corresponding to each controlling field value.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

                                         

JayanthJayanth

Actually the dependent picklist values are selected and included.

Also I have ensured that the API version of the VF page is above 19.0

Yet,the response has been the same

mikefitzmikefitz

Sounds like you have multiple recordtypes for this object.

Ensure when you instantiate the object set the recordtypeid and the recordtype should be considered.

 

emp_con__c tempCon = new Temp_con__c(recordtypeid='12345678');

 

JayanthJayanth

thanks mike, But this custom object has no record types.

could this be an issue?

mikefitzmikefitz

Recordtype is not required. Sorry I didn't notice you mentioned that in your original post.

It looks like you are doing everything right.

As long as the API >19.0 then it's gotta be a small issue that is being overlooked.
May fire up a test page and controller and see if you can reproduce it with just the one object and two fields


Temp_con__c tempCon = new Temp_con__c();

<apex:inputField value="{!tempCon.Region__c}"/>
<apex:inputField value="{!tempCon.SubRegion__c}"/>

This was selected as the best answer
JayanthJayanth

Oh my bad....there happened to be a composition tag on the page and the API version of the particular template page was below 19