1

I am working on making a dynamic Opportunity edit page that hides and renders the displayed fields as the stage is updated. Now, when I change my stage, the fields listed under my "Actions" section change to match the new stage. For this, I have a checkbox on my stage 2 section that displays additional task related fields when the opportunity moves to Stage 3. I have the exact same checkbox on stage 3 that the owner can also check or uncheck, if they made a mistake at stage 2.

Right now, if I check the Sample Requested box while the Stage 2 fields are displayed, and then change to stage 3, the Sample detail fields are showing. However, that same Sample Requested checkbox on the stage 3 rendered section is not checked.

Am I able to make it so that when the box is checked on the Stage 2 section, the stage 3 copy of that is also checked, and vise versa?

Here is a snippet of my VF page, in case that helps explain my question. For this, I removed most of the fields that I think are irrelevant for this question.

The checkbox that I have duplicated between Stage 2 and Stage 3 is this.

apex:inputfield Value="{!Opportunity.Sample_Requested__c}"

    <apex:OutputPanel id="Stage2" >
        <apex:pageBlockSection title="Stage 2 - Presentation" columns="2" rendered="{!Opportunity.StageName == 'Stage 2 - Present LION' || Opportunity.StageName == 'Closed Lost' || Opportunity.StageName == 'Closed Won'}" >
            <apex:OutputText style="font-weight:bold" Value="This stage is when most of the formal presentations take place." />
            <apex:OutputText style="font-weight:bold" Value="Please enter a few words about how the presentation went below." />
            <apex:inputfield Value="{!Opportunity.Presented_to_Key_Decision_Maker__c}" />
            <apex:inputField value="{!Opportunity.Presented_to_Key_Decision_Maker_Text__c}" />
            <apex:inputfield Value="{!Opportunity.Presented_to_Purchasing__c}" />
            <apex:inputField value="{!Opportunity.Presented_to_Purchasing_Text__c}" />
            <apex:inputfield Value="{!Opportunity.Sample_Requested__c}" >
                <apex:actionSupport event="onchange" rerender="Sample" />
            </apex:inputfield>
        </apex:pageBlockSection>
    </apex:OutputPanel>

    <apex:OutputPanel id="Sample" >
        <apex:pageBlockSection title="Sample Details - Uncheck the Sample Requested Box to hide these fields" columns="2" rendered="{!(Opportunity.StageName == 'Stage 3 - Build a Program' && Opportunity.Sample_Requested__c == True) || Opportunity.StageName == 'Closed Lost' || Opportunity.StageName == 'Closed Won'}" >
            <apex:inputfield styleClass="hideDropdown" Value="{!Opportunity.Internal_Coordinator__c}" />
                <style>  
                    .hideDropdown select{
                        visibility: hidden;
                        display: none;
                    }
                </style>  
            <apex:inputfield Value="{!Opportunity.Sample_Item_Requested__c}" />
            <apex:inputField value="{!Opportunity.Email_Info_Packet_To__c}" />
            <apex:inputfield Value="{!Opportunity.Sizes_and_Quantities__c}" />
            <apex:inputfield Value="{!Opportunity.Material__c}" />
            <apex:inputField value="{!Opportunity.Which_Color__c}" />
            <apex:inputfield Value="{!Opportunity.Total_Sample_Units_Requested__c}" />
            <apex:outputlabel value="" />
        </apex:pageBlockSection>
    </apex:OutputPanel>

    <apex:OutputPanel id="Stage3" >
        <apex:pageBlockSection title="Stage 3 - Build a Program" columns="2" rendered="{!Opportunity.StageName == 'Stage 3 - Build a Program' || Opportunity.StageName == 'Closed Lost' || Opportunity.StageName == 'Closed Won'}" >
              <apex:inputfield Value="{!Opportunity.Sample_Requested__c}" >
                <apex:actionSupport event="onchange" />
            </apex:inputfield>
        </apex:pageBlockSection>
    </apex:OutputPanel>

If someone could help point me in the right direction for this, I would appreciate it.

3
  • The problem lies with the rerendering. when you change the state, are you rerendering both Stage2 and Stage3? Is it an "immediate=true" action? Commented Nov 18, 2015 at 18:52
  • You were correct. The Sample Request checkboxes were not rerendering the other stage sections. Once I had the Stage 2 checkbox rerender Stage 3, and the Stage 3 checkbox rerender Stage 2, the checkbox was showing its correct status. If you put that down as an answer, I will mark it as correct. Thanks.
    – smckitrick
    Commented Nov 18, 2015 at 19:23
  • Excellent! I just posted an answer so you can do that. :) Commented Nov 18, 2015 at 19:24

1 Answer 1

2

The problem lies with the rerendering. when you change the state, are you rerendering both Stage2 and Stage3? Is it an "immediate=true" action?

You must log in to answer this question.

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