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
CodeFinderCodeFinder 

Rendered a field in visualforce.

Hi, 

 

I have to change the color of a field based ont he picklist value selected. 

 

I have a custom visualforce page which has the apex:detail tag in it. so the page has a apex:inputText field which is used as a color indecator field for a field called color__c on the object. Now when you include detail tag in visualforce and make an inline edit to the page and save, it does not refresh the entire page. it only refreshes the detail part of the page and updates the record. I want the inputText field to change the color dynamically, when the color__c field in the detail portion of the screen has been changed.

 

<apex:pageBlock id="colorBlock" >
    	<apex:inputText value="{!OM_Order__c.Color__c}" disabled="true" style="background-color:{!OM_Order__c.Color__c};width: 100%;text-align:center;"/> 
            
    </apex:pageBlock>
    <apex:detail inlineEdit="true" />

 is it possible for me to get it done so that I can change the color of the field dynamically?

JHayes SDJHayes SD

Use the rerender attribute on your apex:detail component.  This worked for me:

 

<apex:detail inlineEdit="true" rerender="colorBlock" />

 

Regards, jh