user1066421
user1066421

Reputation: 127

PublishingWebControls:RichHtmlField Rendering not working

i am using site content type RichHtmlField as Full HTML type with value = hello PublishingWebControls:RichHtmlField tag in layoutpage does not render it.

Instead of displaying hello. it is displaying html tags.

Any help wold b appreciated.

Thanks

Upvotes: 0

Views: 3473

Answers (2)

user1316444
user1316444

Reputation: 36

I came across this post while looking for a solution the exact same problem, and I think I found an answer.

In my scenario, I had multiple RichHtmlFields on my page, and one was displaying correctly while another was not. When I viewed the fields via the powershell, I noticed a difference in the SchemaXML, the WORKING field had the following additional properties:

 RichText="True"
 RichTextMode="FullHtml"

I wrote a quick powershell script to update the problem field, and the problem went away for me (look below for script). The change has to be made at the list level for it to take affect on existing pages/lists, but I believe making the modification to the column at the root web (or correct subweb) would work as well.

 $web = $site.OpenWeb($site.RootWeb.ID)
 $list = $web.Lists["Pages"]
 [Microsoft.SharePoint.Publishing.Fields.HtmlField]$field =   [Microsoft.SharePoint.Publishing.Fields.HtmlField]$list.Fields.GetFieldByInternalName("Abst     ract")
 $field.RichText = $true
 $field.RichTextMode = [Microsoft.SharePoint.SPRichTextMode]::FullHtml
 $field.Update()
 $list.Update()

Upvotes: 2

Dr.Denis McCracleJizz
Dr.Denis McCracleJizz

Reputation: 870

Its because your field that is put inside your RichHtmlField is of type Text and Not HTML.

If you have the correct content type here is what you need to do in order to update the list instance from the schema.xml .

First delete any pages that are of the content type, go to your Pages list and delete every column of the content type and then remove the content type. Go into site settings then site content type and delete it. Do that same for the columns. Go to site settings and then columns are delete every columns from your content type (although they should already be missing).

This happens because when you create a website from a Content type, it takes the Schema.xml which describes how the content type is formatted and then instantiates it and gives it to the page so after if the schema is updated, the page is not since its already initiated.

Upvotes: 0

Related Questions