Inserting html into Rich Content from Velo - Display is not recognizing the format

Question:
What must I do to successfully store html in a rich content field from velo?

Product:
Wix Editor and Velo

What are you trying to achieve:
I have a rich content element in my collection/dataset. On save of a record in my application, I want to save a formatted version of the attributes to the rich content field. This formatted field will be used on a different page that is used on mobile devices to view the data (much more smoothly than the discrete fields).

What have you already tried:
Note: I originally tries just storing the html but it did not work. The Wix support AI suggeste the following code.

“const richContent = {“type”: “richText”,“html”: fmtRichDMOG};” where fmtRichDMOG is formatted html (shown below in the output).

I used the richContent in my dataset update and successfully stored the text.

This is what got stored in my rich content field. NOTE: I replaced all of the “<>” characters with “” so that the html would not be executed in this post. It is proper html in my data.
{
“type”: “richText”,
“html”: “PROJECT DEMOGRAPHIC[br]House #: 370[br]Project Code: 370-1051[br]Project Name: Lease/Agreement Approval[br]Project Type: Lease Approval[br]Project Status: In Progress[br]Lease Start Date: 1[br]Lease End Date: 2025.06.10[br][br]Project Created: 2025.05.30 16:30[br]Last Updated: 2025.06.10 13:30[br]This project IS NOT in response to a violation letter from the Board.[br]------------------------------[br]PROJECT DESCRIPTION[br][p]Description Test[/p][p]Test again[/p][p]Third time is the charm??[/p][br]------------------------------”
}

It does not display on the page. When I go to my collection in CMS, it shows an error and offers to convert it for me.

Just to clarify, I am trying to do this using velo code.

I’m sure that I am missing something simple, any assistance is appreciated.

Hi, @STUART_PIERCE !!

Hello! I’d like to share a link that might be helpful. :innocent:

@onemoretime Thank you for sharing that thread. I had looked at it before logging mine but I was a bit frazzled and I thought it looked way more involved than what I needed. As it turns out, I took some time and parsed out the solution and found that I could glean from it what I needed.

Here’s my simplified version:

const richContent = {
“nodes”: [
{
“type”: “HTML”,
“id”: “”,
“nodes”: ,
“htmlData”: {
“containerData”: {
“textWrap”: true,
“height”: {},
“spoiler”: {},
“alignment”: “LEFT”,
“width”: {“custom”: “800”}
},
“html”: fmtRichDMOG,
“source”: “HTML”
}
}
],
“metadata”: {
“version”: 1,
“createdTimestamp”: “2025-06-13T17:56:18.279Z”,
“updatedTimestamp”: “2025-06-13T17:56:18.279Z”,
“id”: “4a2b45f0-bd5d-4414-891b-184595ab32fe”
},
“documentStyle”: {}
};

My variable fmtRichDMOG has my rich content formatted as html.

1 Like

I’m glad to hear that. If you have the chance, please thank Mark as well. :innocent: