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
the_wolfthe_wolf 

Need help!! For Rich Text Field in a Visualforce Template

Hi all, 

 

i'm trying to use Rich Text Field on a Salesforce site's page with a custom controller. 

I updated both the controller and Visualforce page version at 18.0 :

 

- the controller, after this save, works correctly 
- but when i try to saving the version of this visualforce page, the error will appear is: 
"Error: Invalid field Description__c for SObject Ospitalita__c" 
(Description__c is the Rich Text Field) 


For your info, if i insert this rich text field in a empty visualforce page, it works correctly. 
But i give the error in my site pages , which have the template tags (apex:composition and apex:insert) . 

Are "this tags" the problem? 

How can i fix it? 
I need apex:composition and apex:insert and i don't want to delete them or substitute with component.

 

Thanks in advance!! 

Best Answer chosen by Admin (Salesforce Developers) 
the_wolfthe_wolf

With summer '10 release,

 

the Rich Text Field is no longer to version beta and now it is compatible with Visualforce Template tags!

 

Thanks paul to your suggestion with the Visualforce page version 19.0.

All Answers

imuinoimuino
Are you sure you enabled the site to access the object? and, specially that field?
the_wolfthe_wolf

Hi imuino

 

yes, i enabled both the site and rich text field to that object.  But the problem is before access settings.

 

 

The visualforce page doesn't save if i insert RTF ;

 

so if I display the page not trough the site but by appending apex/myPage in Salesforce istance, i see the myPage without that field (because it is not saved into page)

 

Have you tried to use RTF inside an <apex:define> tag? 

imuinoimuino

Try this, put the Field into an inputText tag instead of an insert.

If that doesn't work just try to save the page code on the web editor on your org, not from eclipse

Eclipse doesnt recognize this type of field as far as i know, thats why it "doesnt exist" to it.

the_wolfthe_wolf

I tryed into web editor (i don't use eclipse for visualforce) and i see the famous error..

 

My problem is on VIEW that field (the value is a specific record by put id parameter on this page). I don't use it as input field into page.

 

See below: this tag works correctly on empty page (without template and apex:define)

 

<outputText value="Description_rich__c" />

 

But the same tag gives the error when i try to view this field in to <apex:define>....

 

 

 

 

imuinoimuino

<outputText value="Description_rich__c" />

shouldnt be the apex word on the tag name?

<apex:outputText value="Description_rich__c" />

the_wolfthe_wolf

I'm sorry,

 

the complete tag is:

 

<apex:outputText value="Description_rich__c"/>

 

the_wolfthe_wolf

When the Rich Text Field beta will update to final release ?

 

(so compatible with apex:composition and apex:define tag? )

Kirk F.ax361Kirk F.ax361

So, you have a richtext field "Description__c" on your object Ospitalita__c. 

 

Currently, for me, this won't work:

{!Ospitalita.Description__c}

 

(in my org, I just see the characters  "Ospitalita.Description__c" appear in the visualforce page output.)

I think it's because the richtext field contains HTML, and by default visualforce pages will escape HTML.  But if you turn that off explicitly, it seems to render well for me.

 

This may work:

<apex:outputText value="{!Ospitalita.Description__c}" escape="false" />

 

NOTE: unescaping HTML fields is dangerous, if you don't have complete control over who enters the HTML.  For example, if someone with edit ability on the Description__c field modifies it so it has evil javascript inside, well, that's your responsibility.  ;-)   I think salesforce may filter some of the HTML for us, but you should be cautious.
the_wolfthe_wolf

Hi Kirk,

 

thanks for reply.

My problem is not on the warnings on escape HTML on Rich Text, but which the Visualforce page is not saved  with the RTF field

<apex:outputText value="{!Ospitalita.Description__c}" escape="false" />

, because it returns this error:

"Error: Invalid field Description__c for SObject Ospitalita__c"


In particular this bug only happens when if there are the "template" tags apex: composition and apex: define in Visualforce page.

 

If I use RTF field in an empty Visualforce page, it works correctly !

 

I hope I have explained my problem well

jericmonjericmon

I found myself in the same problem. Have you found any way around this or should we just wait until the Rich Text Fields are out of the Beta phase?!

LaurentDelcLaurentDelc

Indeed this is a big issue.

Any news from Salesforce?

For instance I can't find anywhere the implications of Rich text field being in Beta. Can we use them in production?

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!

 

 

the_wolfthe_wolf

With summer '10 release,

 

the Rich Text Field is no longer to version beta and now it is compatible with Visualforce Template tags!

 

Thanks paul to your suggestion with the Visualforce page version 19.0.

This was selected as the best answer
Force.com discussion forumForce.com discussion forum

hi All,

I have rich text field and i want to display the that field data in visaul force page.

i used  <apex:outputText style="font-size:11px;" value="{!descr.Description_Language__c}:" escape="false"/> to display the RTF data but still it is displaying the RTF data on UI like '<span><p> this is desc. </p> </Span>' instead of 'this is desc.'

 

can any one please tell me the resolution , is it possible to do this in visual force/apex or if there are any other workaround which will remove these html tag either by using the java script tag or any other way. 

sravusravu

I tried to change the Version but it did not work. Still it is showing the HTML tags in the output. I was on 20.0 and changed to 19.0. Any idea why is this happening?