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
R_ShriR_Shri 

Hide or display outputfields on basis of picklist

Hi,

I am trying to replace/override Standard Opportunity detail page with a visualforce page.
I am sucessfull in displaying allmost all the fields properly but I am having problem with some.

Scenerio of problem.
      1. On change of Stage field I want to show some fields and hide some.
             If Stage = "Closed Lost"  Custom_Fld1, Custom_Fld2, Custom_Fld3 should be displayed
             and if Stage = "Closed Won" Custom_Fld3, Custom_Fld4 should be displayed

I have used following code:

apex:page standardController="Opportunity" docType="html-5.0" id="TheOppPage" tabStyle="Opportunity" extensions="Opporunitycntrlr">
  
    <apex:form >
        <apex:pageBlock mode="maindetail" title="Opportunity Detail" id="thePageBlockDetail1"> <!--mode="inlineEdit"-->
            <!-- All Buttons are defined here-->
            <apex:pageBlockButtons >
                <apex:commandButton action="{!edit}" id="editButton" value="Edit"/>
                <apex:commandButton action="{!save}" id="saveButton" value="Save"/>
                <apex:commandButton action="{!delete}" id="deleteButton" value="Delete"/>
                <apex:commandButton action="{!cancel}" id="cancelButton" value="Cancel" style="display:none" />
            </apex:pageBlockButtons>
          
            <apex:pageBlockSection title="Opportunity Information1111111" id="thePageBlockSectionDetail11">
                <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton, deleteButton" event="ondblclick"
                    changedStyleClass="myBoldClass" resetFunction="resetInlineEdit" />
              
                <apex:actionRegion >
                    <apex:outputField value="{!opportunity.StageName}">
                        <apex:actionSupport event="onchange" reRender="otptpnl1"/>
                    </apex:outputField>
                  
                </apex:actionRegion>
                    <apex:outputPanel id="otptpnl1">
                        <apex:outputField value="{!opportunity.Probability}" id="Prbblty"/>                  
                        <apex:outputField value="{!opportunity.Custom_Fld1__c}" rendered="{!opportunity.StageName = 'Closed Lost'}"/>
                        <apex:outputField value="{!opportunity.Custom_Fld2__c}" rendered="{!opportunity.StageName = 'Closed Lost'}"/>
                        <apex:outputField value="{!opportunity.Custom_Fld3__c}" rendered="{!opportunity.StageName = 'Closed Won' || opportunity.StageName = 'Closed Lost'}"/>
                        <apex:outputField value="{!opportunity.Custom_Fld4__c}" rendered="{!opportunity.StageName = 'Closed Won'}"/>
                    </apex:outputPanel>
              
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
    <apex:relatedList list="OpportunityLineItems"/>
    <apex:relatedList list="OpenActivities"/>
    <apex:relatedList list="ActivityHistories"/>
    <apex:relatedList list="CombinedAttachments"/>
    <apex:relatedList list="OpportunityContactRoles"/>
    <apex:relatedList list="OpportunityPartnersFrom"/>
    <apex:relatedList list="OpportunityCompetitors"/>
    <apex:relatedList list="OpportunityHistories"/>
</apex:page>

The main problem I am facing is that in inline edit I'm not getting all the fields displayed (I have validation rules on these custom fields). So when I try to edit any field (say stage) I'm not getting other fields on display and hence I'm not able to change them therefore I'm getting error while saving. Also probablity is not getting refreshed automatically.

Note: Custom_Fld1, Custom_Fld2, Custom_Fld4 are dependent picklist (dependet Stage) and Custom_Fld3 is a text field.

Thanks,
R_Shri
R_ShriR_Shri
In short I don't want rendered attribute to be worked in inlineEdit mode.

Please reply soon.