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
CloudConversionCloudConversion 

Using the New "Rich Text Area" Data Type in VisualForce?

We're trying to use the new "Rich Text Area" Data Type in our VisualForce pages, but getting the following error:

 

"Error: Invalid field Main_Content__c for SObject CloudConversion__Portal_Content__c"

 

This is supported yet?  Is there a special trick to get it to work?

 

Thanks,

Jon 

 

 

<apex:outputText escape="false" value="{!content.Main_Content__c}"/>

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
CloudConversionCloudConversion

Ok, thanks for all your help!  I figured out a workaround, but I believe this is a bug.

 

Apparently, the <apex:composition> and <apex:define> don't play nice with the new Rich Text fields.

 

So, we've just changed the <apex:insert> to instead be a component.

 

Thanks,

Jon 

All Answers

TehNrdTehNrd

What about:

 

<apex:outputField value="{!content.Main_Content__c}"/>

 

Is the instance on Spring 10?

CloudConversionCloudConversion

Nope, get the same error.  Yes, this is Spring '10 with the new Rich Text Area field.

 

Thanks,

Jon 

TehNrdTehNrd

Only other thing I can think if is that this field, "Main_Content__c" doesn't exist on this object "CloudConversion__Portal_Content__c" as this is what the messages is saying.

 

If your positive it exists and spelling is correct you may need to reach out to salesforce support.

BritishBoyinDCBritishBoyinDC

"<apex:outputfield"

 

Hmm, odd - the tag above works for me with a Rich Text field using a simple page with a standard controller for a custom object. Works on both an internal VF page and an external Sites page...

 

 

 However, if I try and change the API version of the page to 17.0, I get the same error - so check that the API version page is also set to 18.0

 

Message Edited by BritishBoyinDC on 02-12-2010 04:50 PM
Message Edited by BritishBoyinDC on 02-12-2010 04:52 PM
CloudConversionCloudConversion
Hmm, strange.  We are trying to use it on a Salesforce site with a custom controller, but it won't even allow me to save the VisualForce page with the Rich Text field in it...  
BritishBoyinDCBritishBoyinDC
Change the API version of the Page to 18.0
CloudConversionCloudConversion
Yes, I already did that on both the Apex class and the VF page, but still getting the "Error: Invalid field Main_Content__c for SObject CloudConversion__Portal_Content__c" error when I try to save the VF page...
BritishBoyinDCBritishBoyinDC
If you create a new page with the standard controller, does it work?
CloudConversionCloudConversion

Ok, thanks for all your help!  I figured out a workaround, but I believe this is a bug.

 

Apparently, the <apex:composition> and <apex:define> don't play nice with the new Rich Text fields.

 

So, we've just changed the <apex:insert> to instead be a component.

 

Thanks,

Jon 

This was selected as the best answer
BritishBoyinDCBritishBoyinDC
Good to know - thanks
Message Edited by BritishBoyinDC on 02-12-2010 06:03 PM
jeremyajohnsonjeremyajohnson

I have a rich text area field "Additional Info" on a custom object on a VF page (overriding New/Edit) using the standard controller for the object. I would like to be able to edit this rich text field on my VF page:

 

<apex:pageblocksection>

     <apex:inputField value="{!MyObject__c.Additional_Info__c}"/>

</apex:pageblocksection>

 

Before reading this post, I received a similar error message from the VF page compiler which would not allow the page to save ("Error: Invalid field Additionalnfo__c for SObject MyObject__c").  After changing the page version to 18.0, I can now save the VF page, however it results in the following error in the main window:

"Invalid field 'additional_info__c' for SObject 'MyObject__c'."

 

I'm not using any components or compositions, so I didn't think the previous post applied to my case.

 

Suggestions greatly appreciated!

 

 

 

 

CloudConversionCloudConversion

Try:  <apex:inputTextArea richText="true" value="{!MyObject__c.Additional_Info__c}"/>

 

Also, I logged a case last week and was unable to reproduce the issue for Salesforce support yesterday.  It was either fixed during that week or something else was causing the issue.  So, we're going back to using templates now.

 

Thanks,

Jon 

jeremyajohnsonjeremyajohnson

I tried inputTextArea right after my last post.  It results in the same error.  What's interesting is that if I use a regular text field (not Rich Text), it works fine while editing.  However, it displays with all the markup on the default detail page. 

 

I also tried using inputTextArea with a variable passed to my controller extension.  I thought I my extension could read the input from the rich text area and then assign it to my Rich Text Area field.  The same error occurred while compiling the extension (Invalid field Additional_Info__c for sObject ...).

jeremyajohnsonjeremyajohnson
Just got it working by updating the version of my controller extension to 18.0.  It compiled with the rich text field, and it saves the result just fine.
Paul BourdeauxPaul Bourdeaux

I had the same problem and I was able to fix it!  It is a simple versioning issue!

 

Check the version of the visualforce page or class or trigger, etc . that you are trying to save.  Most likely it is an older version that cannot access rich text areas.  Simply update the version to the latest one (I am on 19 now), and save it.  Now you should be able to reference rich text areas without problem!

 

Hope that helped!

 

nilofer@sitnilofer@sit

Hi,

As an administratoe, From where can i update the Api version?

 

KKHKKH

Thanks for the answer!