Rich Text fields and Rerender

4:35 PM

You  might be knowing that there is a field type called "Rich Text Field". This field allows you to format the text that you enter, add a URL, Insert pictures etc. It looks mostly like a big textbox with a editing toolbar at the top of the textbox. This is how a rich text field looks like.

The number of visible lines (the value that you specify while creating the field or editing it at Setup -> Object -> Field) controls the height of this field in a Visualforce Page. You may also use the style attribute to define your own height.

Rerender
Rich Text fields do not work with rerender. So, if you say that you have a button "Add another box", and clicking on this would rerender the panel and add one more rich text field, then this wont work. You will have to remove the "rerender" attribute and it works.

You should not have the "immediate=true" attribute as well on the commandbutton. This causes the value of the existing rich text fields to be lost.

So, if you have a button in a page which adds more "Rich Text Fields" or does some other rerendering, remove all the rerenderings and do  a full page refresh. If you still face issues, remove the "immediate=true" attribute and try again.

3 comments

  1. Can i make a word document using this..
    can you help me in making simulation of MS Word using .NET

    ReplyDelete
  2. Hi.. if you would like to create a Word Document with data from Salesforce, there are several options to do this. Mail Merge is one such option, you can also create a Visualforce Page with the vale contentType='application/msWord'. Check this link for an example Click here

    ReplyDelete
  3. Is it possible to perform rendered based on rich text field?


    Event_Image__c is a rich text field.

    ReplyDelete

AD