I am having a custom page on opportunity which has dependent picklist where Market Place is dependent on venue

On child page I am setting values as


where venueId is <apex:inputField value="{!oppty.Venue__c}" required="false" id="VenueId" />

I am not able to get dependent picklist value in market place.

  • Instead of JS, can you try setting in constructor or controller method? Jul 16, 2015 at 9:12
  • I did not got you how can i set value="{!oppty.Venue__c}" from another controller? Jul 16, 2015 at 9:48
  • Maybe I did not get your question right but - if you have the picklist dependent on object then you only need to show them up on visualforce page using inputfield, and it will work. Jul 16, 2015 at 9:53
  • I want to set picklist value using javascript I am using window.parent.opener.document.getElementById(venueId).value='{!JSENCODE(venueValue)}'; but picklist value is not getting set. How to set input field with picklist value using javascript is my question. Jul 16, 2015 at 10:24

1 Answer 1


If you are having multiselect picklist, value in multiselect can be set as

<script type="text/javascript">
function setValue()
    var desiredValue = '{!JSENCODE(venueValue)}';
    var selectedItem= window.parent.opener.document.getElementById(venueId+ '_selected');

    var unselectedItem = window.parent.opener.document.getElementById(venueId + '_unselected');
        for(var i=0; i<unselectedItem.options.length; i++) {

        if ( unselectedItem.options[i].text == desiredValue ) {

Here one should not forget to append _selected and _unselected to get Id for multiselect picklist.

If you are having single select picklist you just have to assign value and call onchange fuction so that dependent picklist value gets populated. It can be done as <script type="text/javascript"> function setValue() { window.parent.opener.document.getElementById(venueId).value='{!JSENCODE(venueValue)}'; window.parent.opener.document.getElementById(venueId).onchange(); } </script>

You must log in to answer this question.

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