How can I take html and prepopulate a rich text field with it?

  • 2
  • Question
  • Updated 2 years ago
I'm trying to prepopulate a rich text field with formatting as html. The source for my html is an email template. 
What I've done so far is use a model to get the appropriate email template and the action framework to prepoulate the rich text field (which is an actual object field). 
However the rich text field flashes the rendered html as expected and then displays the raw html. 

Looking at the html source, I think that the html is being inserted as actual html so it displays as I expect, but then CK editor is escaping the html into text so it displays the raw html in the text editor. 

How can I take html and prepopulate a rich text field with it? 


Flashes this (which is what the html email looks like)

And then displays this

Photo of Shmuel Kamensky

Shmuel Kamensky, Champion

  • 4,328 Points 4k badge 2x thumb

Posted 2 years ago

  • 2
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
Have you tried to use a template component instead of the rich text editor, and clicking the "allow HTML" checkbox?
Photo of Shmuel Kamensky

Shmuel Kamensky, Champion

  • 4,328 Points 4k badge 2x thumb
I have gotten it to display properly like that, but the field needs to be editable by the user.
Photo of Shmuel Kamensky

Shmuel Kamensky, Champion

  • 4,328 Points 4k badge 2x thumb
Is anyone able to help with this please?
Photo of Matt Brown

Matt Brown, Employee

  • 798 Points 500 badge 2x thumb
Shmuel, if you are wanting to apply html to a field that is editable by the user, then a JS custom renderer will most likely be the best course of action. The template and rich text components are really only for displaying information not being edited. 
Photo of Shmuel Kamensky

Shmuel Kamensky, Champion

  • 4,328 Points 4k badge 2x thumb
Thanks Matt. Your guidance is appreciated! 
Photo of Matt Brown

Matt Brown, Employee

  • 798 Points 500 badge 2x thumb
Here is our tutorial on creating a custom renderer in a Table (it's very similar in a Field Editor as well): http://help.skuid.com/m/11720/l/204496-table-component-custom-field-renderers
Photo of Shmuel Kamensky

Shmuel Kamensky, Champion

  • 4,328 Points 4k badge 2x thumb
Hi Matt,

The guide was helpful. Thank you! I wanted to let you know some of the examples don't work anymore (seems to have something to do with the silk icon set).