Geeks With Blogs
Thorvald Bøe
When programming against SharePoint using Javascript and REST, there is a little gotcha when using the "multiple lines of text" type in a list. When retrieving a value for this type of field, the result is by encoded to support rich text, like this:

If you want to simply retrieve and use the text value, you've got a problem. My first thought was to decode the string using some kind of jquery method. This is not so simple as it seems, and while there are ways to get it done, you will still be in trouble if you want to save the updated text value back to SharePoint, because it would require the surrounding tags to be set properly. You could of course use regular expressions or similar to retrieve the text, store the formatting tags and then put it all back together before saving, but there is a much simpler way, provided you are just interested in the text.
Simply look up the field (Description in this case) in SharePoint, and enter the details page by clicking the Description link.
Then change the option from Enhanced rich text (default) to plain text. And voila - it works!
Posted on Thursday, January 9, 2014 3:57 PM jquery , sharepoint , REST , rich text | Back to top

Comments on this post: Javascript and SharePoint rich text fields

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Thorvald Bøe | Powered by: