Displaying HTML with Jelly in a UI page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2012 09:32 AM
So, I went into this project thinking this was going to be pretty straight forward. And, maybe it is. But what I thought should work intuitively isn't working as I anticipated and the information I'm finding online isn't working.
What I'm trying to do is display some HTML (on a UI Page) which is stored in a variable. Example...
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate>
var test = "<b>this is bold</b>";
</g:evaluate>
${test}
</j:jelly>
In case it's not clear, the desired outcome is to have a simple bold text "this is bold" display on the UI Page when visited. However, when you visit the page it looks like:
<b>this is bold</b>
Clearly the HTML is being encoded at some point in this whole thing and, despite searching forums and Google, I'm unsure how to fix it. Any ideas?
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2012 07:37 AM
If you are satisfied with my response,are aren't looking for another interpretation , please mark this as answered.. This will help the other community members to concentrate on those questions which need reponses.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2013 07:45 AM
Without the need of an intermediate input, but almost the same.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_str">
test = "<b>Bold</b>";
</g:evaluate>
<div>
<script>
document.write('${jvar_str}');
</script>
</div>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2013 01:28 AM
Stumbled across this thread when looking for a solution but have since found an easier way that works for me.
I'm doing a Glide query to get the data from an HTML field and need to output it as HTML to a UI page.
There is a ready made Jelly tag to do the escaping / decoding for you it seems:
<g2:no_escape>$[gr.myHTMLField.getDisplayValue()]</g2:no_escape>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2013 08:43 PM
Thanks Paul, this definitely is a better way of doing it.
Also, the reason why I had to show the solution the way I did, is because I had to explain why the code given doesn't work 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2020 10:20 AM
"no_escape" seems super ominous, but it worked for me, so thanks!