Rich text displayed from database

Hi, I am trying to display some text which I have entered in the database (read only) I can’t connect rich text to to the database I have and my text does not display correctly, it displays in html format? Is rich text not intended for this? I can get it to display what I want if I just have text but then its the basic text and I want to customise it.

Any ideas?

Actually ,the same problem is also happening with me.

1 Like

Hello

you can fix this issue by setting the texts value using code.

  • get the current item from database
  • set the value to the text using .html method

check this : Text - Velo API Reference - Wix.com

Best

Massa

1 Like

I think I am having the same issue, however don’t understand Massa’s fix.
I have a database set up with a rich text field:


The plain text fields display just fine, the Rich Text field displays as plain text with all the HTML tags:


How can I get the Rich Text to display as it was formatted in the Rich Text box within the database?

I did just discover another forum with the exact same problem, but the solution did not work for me:
https://www.wix.com/corvid/forum/community-discussion/rich-text-from-database-displaying-html-on-live-site

Use the .html property instead of the .text property

// This will display properly as rich text format
$w('#textElement').html = "<p>This is <b>bold</b></p>"    
        This is bold
// This will display as plain text html
$w('#textElement').text = "<p>This is <b>bold</b></p>"    
        <p>This is <b>bold</b></p>
3 Likes

Not working

What isn’t working? This is an old post and will be closed. Please post a new question explaining exactly what it is you are trying to do.