Find your content:

Search form

You are here

How to disable rtf field in visualforce page

 
Share

I have a requirement where one sf rtf field has to be disabled based on some condition. I am not finding any solution for disabling rtf. Anybody worked on this or any work arounf for this?


Attribution to: Shebin Mathew

Possible Suggestion/Solution #1

https://help.salesforce.com/HTViewHelpDoc?id=fields_using_rich_text_area.htm&language=en_US

Check the link which may help you


Attribution to: PavanFoxPro

Possible Suggestion/Solution #2

Much depends on what you mean by disabled. The examples below assume your object instance is MyObj__c, the RT field is My_RTF__c and the field that determines if the RT field should be displayed is Other__c.

If you don't want the RT field to be displayed based on the value of another field, you can use conditional rendering:

<apex:inputField value="{!MyObj__c.My_RTF__c}" rendered="{!MyObj__c.Other__c=='showRTF'}" />

If you want the input to remain, but not be a rich text variety, you could keep the about line of markup to render the RT, but if the value of Other__c is not showRTF, then render a regular text area backed by the field

<apex:inputTextArea value="{!MyObj__c.My_RTF__c}" rendered="{!MyObj__c.Other__c!='showRTF'}" />

If you need to react to the changing of the Other__c field elsewhere in the page, I'd look at adding an <apex:actionSupport /> element to the Other__c input, which can rerender the part(s) of the page that contain the conditionally rendered items.


Attribution to: Bob Buzzard
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/30949

My Block Status

My Block Content