Question

A string field contains html data with tags. how to display that string as html snippet in UI
Getting the data with html tags from an external application and storing that data in a text field in pega. How to present the data in the html snippet in UI.
-
Like (0)
-
Accepted Solution
I forgot to tell, in this aswell the formatting will be lost. Do the following for format to be retained:
Add a <pre> tag before the reference. Change the existing RichTextDisplay contol code to:
<pre><pega:reference name='$this-value' mode="literal"/></pre>

Hello Ashok,
Use Regular Expressions in custom java code to resolve this.
take the stream to a property and use this expression
@String.pxReplaceAllViaRegex(local.RemoveTags,"<(.|\n)*?>",""). This will replace all the tags with a space.
Kindly check the below URL for your reference:-
https://collaborate.pega.com/question/how-remove-html-tags-string-while-displaying-rd
Hope this helps.
Regards,
Hari

Hi Hari,
Thank you for your quick response. I am already using Regex expression to remove but still the customer want it to be displayed as html snippet so that it can be presented in better readable manner. Because if am using reg expression then it is coming as big paragraph, not readable because the data contains date and other information. This data is for notes captured for user actions. So from client getting the formatted data in html into a string filed in pega. So Client suggested to use actual html it is separated by new lines based on the date notes it was it was entered.
Please see the mock up data attached. How to present this as html snippet in Pega from a text filed in UI. Please suggest. thanking you in advance.
Regards,
Ashok

Hello,
Still I am looking for Assistance. Any help in this regard would be appreciated..
Regards,
Ashok

Try using the RichTextDisplay control. It will display the content in literal mode
Accepted Solution
I forgot to tell, in this aswell the formatting will be lost. Do the following for format to be retained:
Add a <pre> tag before the reference. Change the existing RichTextDisplay contol code to:
<pre><pega:reference name='$this-value' mode="literal"/></pre>

thanks Kakul, i was looking for the same... appreciate ur help

Sorry for the delay in response. I was busy with other projects and could not try this. Working perfect.. Thank you very much Kakul.

Instead of non-auto generated RIchTextDisplay control, I'd strongly suggest using RichTextEditor control in 'forced' ReadOnly mode.