You need to sign in to do that
Don't have an account?

hide fields using CSS
I am trying to hide Stage field of opportunity from visualforce page but I am not able to achieve the task.
If I am using style="display:none" nothing is happening and if I am using rendered="false” I am getting error as “The inline edit-enabled dependent picklist 'Lost Reasons' requires its controlling field 'Stage' to be present on the page.” Please help me regarding this ASAP.
I have used the below code. Please let me know if I am missing out something.
<apex:page standardController="Opportunity" docType="html-5.0" id="TheOppPage" tabStyle="Opportunity" showChat="false">
<apex:form >
<apex:pageBlock mode="maindetail" id="thePageBlockDetail1" rendered="{!opportunity.StageName = 'Closed Won' || opportunity.StageName = 'Closed Lost'}">
<!-- All Buttons are defined here-->
<apex:pageBlockButtons >
<apex:commandButton action="{!edit}" id="editButton" value="Edit" style="display:none"/>
<apex:commandButton action="{!save}" id="saveButton" value="Save" style="display:none"/>
<apex:commandButton action="{!delete}" id="deleteButton" value="Delete" style="display:none"/>
<apex:commandButton action="{!cancel}" id="cancelButton" value="Cancel" style="display:none" />
</apex:pageBlockButtons>
<!--Main details of this opportunity are defined here. -->
<apex:pageBlockSection id="thePageBlockSectionDetail1">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton, deleteButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit" />
<apex:outputField value="{!opportunity.StageName}" style="display:none"/>
<apex:outputField value="{!opportunity.Won_Reasons__c}" rendered="{!opportunity.StageName = 'Closed Won'}"/>
<apex:outputField value="{!opportunity.Lost_Reasons__c}" rendered="{!opportunity.StageName = 'Closed Lost'}"/>
<apex:outputField value="{!opportunity.customfield1__c}" rendered="{!opportunity.StageName = 'Closed Lost'}"/><br/>
<apex:outputField value="{!opportunity.customfield2__c}" rendered="{!opportunity.StageName = 'Closed Lost'}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Thanks in advance!
:)
Regards,
R_Shri
If I am using style="display:none" nothing is happening and if I am using rendered="false” I am getting error as “The inline edit-enabled dependent picklist 'Lost Reasons' requires its controlling field 'Stage' to be present on the page.” Please help me regarding this ASAP.
I have used the below code. Please let me know if I am missing out something.
<apex:page standardController="Opportunity" docType="html-5.0" id="TheOppPage" tabStyle="Opportunity" showChat="false">
<apex:form >
<apex:pageBlock mode="maindetail" id="thePageBlockDetail1" rendered="{!opportunity.StageName = 'Closed Won' || opportunity.StageName = 'Closed Lost'}">
<!-- All Buttons are defined here-->
<apex:pageBlockButtons >
<apex:commandButton action="{!edit}" id="editButton" value="Edit" style="display:none"/>
<apex:commandButton action="{!save}" id="saveButton" value="Save" style="display:none"/>
<apex:commandButton action="{!delete}" id="deleteButton" value="Delete" style="display:none"/>
<apex:commandButton action="{!cancel}" id="cancelButton" value="Cancel" style="display:none" />
</apex:pageBlockButtons>
<!--Main details of this opportunity are defined here. -->
<apex:pageBlockSection id="thePageBlockSectionDetail1">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton, deleteButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit" />
<apex:outputField value="{!opportunity.StageName}" style="display:none"/>
<apex:outputField value="{!opportunity.Won_Reasons__c}" rendered="{!opportunity.StageName = 'Closed Won'}"/>
<apex:outputField value="{!opportunity.Lost_Reasons__c}" rendered="{!opportunity.StageName = 'Closed Lost'}"/>
<apex:outputField value="{!opportunity.customfield1__c}" rendered="{!opportunity.StageName = 'Closed Lost'}"/><br/>
<apex:outputField value="{!opportunity.customfield2__c}" rendered="{!opportunity.StageName = 'Closed Lost'}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Thanks in advance!
:)
Regards,
R_Shri
I achieved the task of Hiding the fields by putting the fields in output panel and hiding that output panel
as,
<apex:outputPanel style="display:none">
<apex:outputField value="{!opportunity.StageName}"/>
</apex:outputPanel>
All Answers
<apex:outputField value="{!opportunity.StageName}" html-style="display:none"/>
Regards,
Srinu
Ya I got Error: Cannot override attribute 'style' on component <apex:outputField> if I use html-style="display:none"
So can I remove/hide Stage from Opportunity layout and display on this inline page only (In doing this I am getting an error as This field must be displayed on the page layout and cannot be removed)
I achieved the task of Hiding the fields by putting the fields in output panel and hiding that output panel
as,
<apex:outputPanel style="display:none">
<apex:outputField value="{!opportunity.StageName}"/>
</apex:outputPanel>