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
Sandra OrtizSandra Ortiz 

Visualforce Page display banner based on criteria

I have the code below and want to display the help text found right under my </style> tag based on what the user choosed as the Type.

Can anyone help how i can accomplish that?
 
<apex:page standardcontroller="Contract_Requests__c">
<apex:messages />
    <apex:sectionheader title="{!$ObjectType.Contract_Requests__c.label} Edit" subtitle="{!IF(ISNULL(Contract_Requests__c.Name), 'New Contract Request',Contract_Requests__c.Name)}"/>
    
    
  <apex:form >
        <apex:pageblock mode="edit" title="{!$ObjectType.Contract_Requests__c.label} Edit">
            <apex:pageblockbuttons >
                <apex:commandbutton value="Save" action="{!Save}"/>
                <apex:commandbutton value="Cancel" action="{!Cancel}"/>
            </apex:pageblockbuttons>
            
          <apex:pageBlockSection title="" showheader="false" columns="1">
            <style type="text/css">
        .divAlert0
        {
            padding:2px;
            margin-left:auto;
            margin-right:auto;
            font-size:22px;
            height: 100%;
            width: 100%;
            text-align: center;
            background-color: #ADD8E6;
            font-family:'Arial';
            
        }
    </style>

<apex:outputPanel id="divtest0" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Work Order'}">Provide any existing contract, associated SOWs, etc. to be reviewed in the Notes field. If no additional information, enter None.</apex:outputPanel>
    
<apex:outputPanel id="divTest1" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Amendment'}">Request Standard Amendment form. Please provide Terms and Conditions changes in the Notes field.</apex:outputPanel>
    
<apex:outputPanel id="divTest2" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Statement of Work'  || Contract_Requests__c.Type__c =='Subscription Schedule'}">Use Standard Templates if available.  If none available, please request it here.</apex:outputPanel>
    
<apex:outputPanel id="divtest3" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Cancellation/Termination Notice'}">Provide Cancellation Noticed received from Customer and specifics that will be important in the Notes field.</apex:outputPanel>

<apex:outputPanel id="divTest4" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='NDA'}">If Customer paper, please provide word version for review and tracking. If New Request, provide Customer with Standard Stericycle NDA</apex:outputPanel>
    
<apex:outputPanel id="divTest5" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='BAA'}">If Customer paper, please provide word version for review and tracking. If New Request, provide Customer with Standard Stericycle BAA </apex:outputPanel> 

<apex:outputPanel id="divTest6" styleClass="divAlert0" layout="block" rendered="{!(Contract_Requests__c.Type__c =='Compliance Documentation' || Contract_Requests__c.Type__c =='Security Assessment') && (Contract_Requests__c.Documentation_Attached__c == 'No')}">Please attach the proper Documentation to this request. If you don't have proper documentation, your request may be rejected and you will need to resubmit.</apex:outputPanel>

<apex:outputPanel id="divTest7" styleClass="divAlert0" layout="block" rendered="{!(Contract_Requests__c.Type__c =='Addendum' || Contract_Requests__c.Type__c =='Amendment' || Contract_Requests__c.Type__c =='Renewal Contract' || Contract_Requests__c.Type__c =='Subscription Schedule') && (Contract_Requests__c.Original_Contract_Attached__c == 'No')}">Please request the Contract from the Contract Administration and resubmit this request.</apex:outputPanel>

<apex:outputPanel id="divtest8" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Cancellation/Termination Notice' && Contract_Requests__c.Documentation_Attached__c == 'No'}">If you don't have proper documentation, your request may be rejected and you will need to resubmit.</apex:outputPanel>

</apex:pageblockSection>

            <!-- **********   [Record Type : Master ]   **********  -->
            <apex:outputpanel >
                <apex:pageblocksection title="Information" showheader="true" columns="2">
                    <apex:outputfield value="{!Contract_Requests__c.Name}"/>
                    <apex:outputfield value="{!Contract_Requests__c.OwnerId}"/>
                    <apex:inputfield value="{!Contract_Requests__c.Type__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Status__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Type_Detail__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Priority__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Notes__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Cancel_Reason__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Documentation_Attached__c}" required="true"/>
                    <apex:pageblocksectionitem />
                    <apex:inputfield value="{!Contract_Requests__c.Original_Contract_Attached__c}" required="true"/>
                    <apex:pageblocksectionitem />
                </apex:pageblocksection>
                <apex:pageblocksection title="Customer Info" showheader="true" columns="2">
                    <apex:inputfield value="{!Contract_Requests__c.Lead__c}" required="false"/>
                    <apex:pageblocksectionitem />
                    <apex:inputfield value="{!Contract_Requests__c.Account__c}" required="false"/>
                    <apex:pageblocksectionitem />
                    <apex:inputfield value="{!Contract_Requests__c.Parent_Account__c}" required="false"/>
                    <apex:pageblocksectionitem />
                </apex:pageblocksection>
                <apex:pageblocksection title="Related Records" showheader="true" columns="2">
                    <apex:inputfield value="{!Contract_Requests__c.Contract__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Location__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Opportunity__c}" required="false"/>
                    <apex:pageblocksectionitem />
                    <apex:inputfield value="{!Contract_Requests__c.Contact__c}" required="false"/>
                    <apex:pageblocksectionitem />
                </apex:pageblocksection>
                <apex:pageblocksection title="Additional Info" showheader="true" columns="2">
                    <apex:inputfield value="{!Contract_Requests__c.Renewal_Terms__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Service_Type__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Implmentation_Fee__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Service_Provided__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Pricing__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Service_Provided_Detail__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Responsible_for_Payment__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Services_to_be_Performed__c}" required="false"/>
                    <apex:pageblocksectionitem />
                    <apex:inputfield value="{!Contract_Requests__c.Other_Addendum__c}" required="false"/>
                </apex:pageblocksection>
            </apex:outputpanel>
        </apex:pageblock>
    </apex:form>
    
</apex:page>

 
Best Answer chosen by Sandra Ortiz
Andrew EchevarriaAndrew Echevarria
Remove the inputfield tag from around the actioFunction

All Answers

Andrew EchevarriaAndrew Echevarria
Enclose all of the output options in one big <apex:outputPanel> and give it an Id for example <apex:outputPanel id="outputs">

Then, further in the page, where the type is selected, make it an open tag with actionSupport in the middle <apex:inputField><apex:actionSupport event="onchange" reRender="outputs" /></apex:inputField>. This will make the page rerender the outputs section everytime the Type changes.
Sandra OrtizSandra Ortiz
thankyou Andrew!

Added, thos pieces, getting this error: value for <apex:inputField> is not a dynamic binding! 
 
<apex:page standardcontroller="Contract_Requests__c">
<apex:messages />
    <apex:sectionheader title="{!$ObjectType.Contract_Requests__c.label} Edit" subtitle="{!IF(ISNULL(Contract_Requests__c.Name), 'New Contract Request',Contract_Requests__c.Name)}"/>
    
    
  <apex:form >
        <apex:pageblock mode="edit" title="{!$ObjectType.Contract_Requests__c.label} Edit">
            <apex:pageblockbuttons >
                <apex:commandbutton value="Save" action="{!Save}"/>
                <apex:commandbutton value="Cancel" action="{!Cancel}"/>
            </apex:pageblockbuttons>
            
          <apex:pageBlockSection title="" showheader="false" columns="1">
            <style type="text/css">
        .divAlert0
        {
            padding:2px;
            margin-left:auto;
            margin-right:auto;
            font-size:22px;
            height: 100%;
            width: 100%;
            text-align: center;
            background-color: #ADD8E6;
            font-family:'Arial';
            
        }
    </style>
<apex:outputPanel id="Banners">
<apex:outputPanel id="divtest0" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Work Order'}">Provide any existing contract, associated SOWs, etc. to be reviewed in the Notes field. If no additional information, enter None.</apex:outputPanel>
    
<apex:outputPanel id="divTest1" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Amendment'}">Request Standard Amendment form. Please provide Terms and Conditions changes in the Notes field.</apex:outputPanel>
    
<apex:outputPanel id="divTest2" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Statement of Work'  || Contract_Requests__c.Type__c =='Subscription Schedule'}">Use Standard Templates if available.  If none available, please request it here.</apex:outputPanel>
    
<apex:outputPanel id="divtest3" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Cancellation/Termination Notice'}">Provide Cancellation Noticed received from Customer and specifics that will be important in the Notes field.</apex:outputPanel>

<apex:outputPanel id="divTest4" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='NDA'}">If Customer paper, please provide word version for review and tracking. If New Request, provide Customer with Standard Stericycle NDA</apex:outputPanel>
    
<apex:outputPanel id="divTest5" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='BAA'}">If Customer paper, please provide word version for review and tracking. If New Request, provide Customer with Standard Stericycle BAA </apex:outputPanel> 

<apex:outputPanel id="divTest6" styleClass="divAlert0" layout="block" rendered="{!(Contract_Requests__c.Type__c =='Compliance Documentation' || Contract_Requests__c.Type__c =='Security Assessment') && (Contract_Requests__c.Documentation_Attached__c == 'No')}">Please attach the proper Documentation to this request. If you don't have proper documentation, your request may be rejected and you will need to resubmit.</apex:outputPanel>

<apex:outputPanel id="divTest7" styleClass="divAlert0" layout="block" rendered="{!(Contract_Requests__c.Type__c =='Addendum' || Contract_Requests__c.Type__c =='Amendment' || Contract_Requests__c.Type__c =='Renewal Contract' || Contract_Requests__c.Type__c =='Subscription Schedule') && (Contract_Requests__c.Original_Contract_Attached__c == 'No')}">Please request the Contract from the Contract Administration and resubmit this request.</apex:outputPanel>

<apex:outputPanel id="divtest8" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Cancellation/Termination Notice' && Contract_Requests__c.Documentation_Attached__c == 'No'}">If you don't have proper documentation, your request may be rejected and you will need to resubmit.</apex:outputPanel>
</apex:outputPanel>

</apex:pageblockSection>

            <!-- **********   [Record Type : Master ]   **********  -->
           
            
            
            
            <apex:outputpanel >
                <apex:pageblocksection title="Information" showheader="true" columns="2">
                    <apex:outputfield value="{!Contract_Requests__c.Name}"/>
                    <apex:outputfield value="{!Contract_Requests__c.OwnerId}"/>
                    <apex:inputfield value="{!Contract_Requests__c.Type__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Status__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Type_Detail__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Priority__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Notes__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Cancel_Reason__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Documentation_Attached__c}" required="true"/>
                    <apex:pageblocksectionitem />
                    <apex:inputfield value="{!Contract_Requests__c.Original_Contract_Attached__c}" required="true"/>
                    <apex:pageblocksectionitem />
                </apex:pageblocksection>
                <apex:pageblocksection title="Customer Info" showheader="true" columns="2">
                    <apex:inputfield value="{!Contract_Requests__c.Lead__c}" required="false"/>
                    <apex:pageblocksectionitem />
                    <apex:inputfield value="{!Contract_Requests__c.Account__c}" required="false"/>
                    <apex:pageblocksectionitem />
                    <apex:inputfield value="{!Contract_Requests__c.Parent_Account__c}" required="false"/>
                    <apex:pageblocksectionitem />
                </apex:pageblocksection>
                <apex:pageblocksection title="Related Records" showheader="true" columns="2">
                    <apex:inputfield value="{!Contract_Requests__c.Contract__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Location__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Opportunity__c}" required="false"/>
                    <apex:pageblocksectionitem />
                    <apex:inputfield value="{!Contract_Requests__c.Contact__c}" required="false"/>
                    <apex:pageblocksectionitem />
                </apex:pageblocksection>
                <apex:pageblocksection title="Additional Info" showheader="true" columns="2">
                    <apex:inputfield value="{!Contract_Requests__c.Renewal_Terms__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Service_Type__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Implmentation_Fee__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Service_Provided__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Pricing__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Service_Provided_Detail__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Responsible_for_Payment__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Services_to_be_Performed__c}" required="false"/>
                    <apex:pageblocksectionitem />
                    <apex:inputfield value="{!Contract_Requests__c.Other_Addendum__c}" required="false"/>
                </apex:pageblocksection>
            </apex:outputpanel>
        </apex:pageblock>
    
   <apex:inputField ><apex:actionSupport event="onchange" reRender="Banners" /></apex:inputField>    
    </apex:form>
  
</apex:page>


 
Andrew EchevarriaAndrew Echevarria
Sorry, so inputfield should have an onchange parameter. Create an actionFunction like <apex:actionFunction name="updateOutputs" reRender="outputs" />

Then on inputfield add the parameter onchange="updateOutputs()"

This should work!
Sandra OrtizSandra Ortiz
Sorry, Andrew...I am one of those that copy and paste from differnt places, I dont think I have it right:
 
<apex:page standardcontroller="Contract_Requests__c">
<apex:messages />
    <apex:sectionheader title="{!$ObjectType.Contract_Requests__c.label} Edit" subtitle="{!IF(ISNULL(Contract_Requests__c.Name), 'New Contract Request',Contract_Requests__c.Name)}"/>
    
    
  <apex:form >
        <apex:pageblock mode="edit" title="{!$ObjectType.Contract_Requests__c.label} Edit">
            <apex:pageblockbuttons >
                <apex:commandbutton value="Save" action="{!Save}"/>
                <apex:commandbutton value="Cancel" action="{!Cancel}"/>
            </apex:pageblockbuttons>
            
          <apex:pageBlockSection title="" showheader="false" columns="1">
            <style type="text/css">
        .divAlert0
        {
            padding:2px;
            margin-left:auto;
            margin-right:auto;
            font-size:22px;
            height: 100%;
            width: 100%;
            text-align: center;
            background-color: #ADD8E6;
            font-family:'Arial';
            
        }
    </style>
<apex:outputPanel id="Outputs">
<apex:actionFunction name="updateOutputs" reRender="outputs" />
<apex:outputPanel id="divtest0" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Work Order'}">Provide any existing contract, associated SOWs, etc. to be reviewed in the Notes field. If no additional information, enter None.</apex:outputPanel>
    
<apex:outputPanel id="divTest1" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Amendment'}">Request Standard Amendment form. Please provide Terms and Conditions changes in the Notes field.</apex:outputPanel>
    
<apex:outputPanel id="divTest2" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Statement of Work'  || Contract_Requests__c.Type__c =='Subscription Schedule'}">Use Standard Templates if available.  If none available, please request it here.</apex:outputPanel>
    
<apex:outputPanel id="divtest3" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Cancellation/Termination Notice'}">Provide Cancellation Noticed received from Customer and specifics that will be important in the Notes field.</apex:outputPanel>

<apex:outputPanel id="divTest4" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='NDA'}">If Customer paper, please provide word version for review and tracking. If New Request, provide Customer with Standard Stericycle NDA</apex:outputPanel>
    
<apex:outputPanel id="divTest5" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='BAA'}">If Customer paper, please provide word version for review and tracking. If New Request, provide Customer with Standard Stericycle BAA </apex:outputPanel> 

<apex:outputPanel id="divTest6" styleClass="divAlert0" layout="block" rendered="{!(Contract_Requests__c.Type__c =='Compliance Documentation' || Contract_Requests__c.Type__c =='Security Assessment') && (Contract_Requests__c.Documentation_Attached__c == 'No')}">Please attach the proper Documentation to this request. If you don't have proper documentation, your request may be rejected and you will need to resubmit.</apex:outputPanel>

<apex:outputPanel id="divTest7" styleClass="divAlert0" layout="block" rendered="{!(Contract_Requests__c.Type__c =='Addendum' || Contract_Requests__c.Type__c =='Amendment' || Contract_Requests__c.Type__c =='Renewal Contract' || Contract_Requests__c.Type__c =='Subscription Schedule') && (Contract_Requests__c.Original_Contract_Attached__c == 'No')}">Please request the Contract from the Contract Administration and resubmit this request.</apex:outputPanel>

<apex:outputPanel id="divtest8" styleClass="divAlert0" layout="block" rendered="{!Contract_Requests__c.Type__c =='Cancellation/Termination Notice' && Contract_Requests__c.Documentation_Attached__c == 'No'}">If you don't have proper documentation, your request may be rejected and you will need to resubmit.</apex:outputPanel>
</apex:outputPanel>



</apex:pageblockSection>

            <!-- **********   [Record Type : Master ]   **********  -->
           
            
            
            
            <apex:outputpanel >
                <apex:pageblocksection title="Information" showheader="true" columns="2">
                    <apex:outputfield value="{!Contract_Requests__c.Name}"/>
                    <apex:outputfield value="{!Contract_Requests__c.OwnerId}"/>
                    <apex:inputField ><apex:actionSupport event="onchange" reRender="Outputs" /></apex:inputField>  
                    <apex:inputfield value="{!Contract_Requests__c.Type__c}" required="false" onchange="updateOutputs()"/>
                      
                    <apex:inputfield value="{!Contract_Requests__c.Status__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Type_Detail__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Priority__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Notes__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Cancel_Reason__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Documentation_Attached__c}" required="true"/>
                    <apex:pageblocksectionitem />
                    <apex:inputfield value="{!Contract_Requests__c.Original_Contract_Attached__c}" required="true"/>
                    <apex:pageblocksectionitem />
                </apex:pageblocksection>
                <apex:pageblocksection title="Customer Info" showheader="true" columns="2">
                    <apex:inputfield value="{!Contract_Requests__c.Lead__c}" required="false"/>
                    <apex:pageblocksectionitem />
                    <apex:inputfield value="{!Contract_Requests__c.Account__c}" required="false"/>
                    <apex:pageblocksectionitem />
                    <apex:inputfield value="{!Contract_Requests__c.Parent_Account__c}" required="false"/>
                    <apex:pageblocksectionitem />
                </apex:pageblocksection>
                <apex:pageblocksection title="Related Records" showheader="true" columns="2">
                    <apex:inputfield value="{!Contract_Requests__c.Contract__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Location__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Opportunity__c}" required="false"/>
                    <apex:pageblocksectionitem />
                    <apex:inputfield value="{!Contract_Requests__c.Contact__c}" required="false"/>
                    <apex:pageblocksectionitem />
                </apex:pageblocksection>
                <apex:pageblocksection title="Additional Info" showheader="true" columns="2">
                    <apex:inputfield value="{!Contract_Requests__c.Renewal_Terms__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Service_Type__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Implmentation_Fee__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Service_Provided__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Pricing__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Service_Provided_Detail__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Responsible_for_Payment__c}" required="false"/>
                    <apex:inputfield value="{!Contract_Requests__c.Services_to_be_Performed__c}" required="false"/>
                    <apex:pageblocksectionitem />
                    <apex:inputfield value="{!Contract_Requests__c.Other_Addendum__c}" required="false"/>
                </apex:pageblocksection>
            </apex:outputpanel>
        </apex:pageblock>
    
  
    </apex:form>
  
</apex:page>

 
Andrew EchevarriaAndrew Echevarria
Hm try capitalizing "outputs" in your actionFunction tag. If it doesn't work, I'll replicate it and fix it.
Sandra OrtizSandra Ortiz
No luck - i get this:

value for <apex:inputField> is not a dynamic binding! 
Andrew EchevarriaAndrew Echevarria
Remove the inputfield tag from around the actioFunction
This was selected as the best answer
Sandra OrtizSandra Ortiz
Thank you so much! it worked, I will be able to reuse this template for other items. Thank you for your time!