I have a visualforce page that is used for updating opportunities. I have created a SelectList to control what values are displayed in the stage field (depending on the current stage's value)

The problem I have is that I have a dependent picklist that needs to be on the page at a certain stage.

When I only have the selectList on the page, I get an error that the controlling field needs to be on the page.

How can I continue to use my select list to control the values that display in Stage without getting an error that I need the controlling field on the page?

I got the stage field to work by using the following code:

<apex:inputField id="slStageInput" value="{!stopLossOpp.o.StageName}" style="display:none" label="" />
                                        <!-- custom stage field with limited values -->
                                        <apex:selectList value="{!tempslstage}" size="1" styleClass="required" >
                                            <apex:selectOptions value="{!SlStages}"/>
                                             <apex:actionSupport event="onchange" action="{!SyncSlStage}" reRender="SlOutcome"/>    

However, now, my dependent picklist is not getting updated.




You'd have to either use Apex to enforce the dependency and forego the use of apex:inputField, or you'd have to use JavaScript in order to implement the stage change logic.

  • Thanks for responding! I found a suggestion to add the input field with style="display:none" I will edit my original post with the code. That resolved the original issue. However, I now have an issue where the dependent picklist is not getting updated after I update my select list. Any help would be greatly appreciated!
    – Frank
    Nov 22 '19 at 0:01

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.