Don't render the HTML

I have a situation where I want to set the value of a field to HTML so that in the GRID format the HTML comes out there. For example I have a URL that I want to render in HTML as the value in the grid view so it can be copy and pasted into another input box (not in knack). At the moment I’ve tried to set this using conditional rules on a field, and also by using text formulas - even text formulas with HTML comments around the HTML. Yet, unfortunately still this renders in HTML. Is there any way I could achieve this?

Hi @GSH - As you may be aware, I’m not a coder but I know from having this issue before that when you input raw HTML code such as <a href="https://knack.com/">Visit Knack</a> into a field, Knack automatically interprets and renders it as an actual clickable link. Even if you try to escape the HTML characters or use JavaScript to replace or escape the content after the page loads, this doesn’t prevent Knack from rendering the HTML as a link in the grid view.

The core issue is that the default behavior is to process and display HTML content, making it difficult or impossible to show the raw HTML code as plain text using client-side methods. The JavaScript approach to escape or decode HTML content often doesn’t work because the platform’s rendering logic takes precedence, and scripts can’t fully override the initial HTML interpretation.

Hopefully there is a code wizard out there that can help :woman_technologist:

Here’s a solution I found to not make it render.

Interesting.

But wasnt the second part of this to allow users to copy and paste the html into another screen? Won’t it not work as html there too?

No the goal was to have raw HTML in a grid cell, so that it could be copied and pasted into a field box - which would strip away the invisible formatting. This is what this does.

1 Like

I did this very thing but in my case I need to build a html string combining text code with a known file variable.

Ie surname-serviceno

In this instance the above combined with “.JPG” would give me the file name of his enlistment photo.
I could then paste the constructed location into another appropriate field to show the picture.

This is a constructed text formula stored on the file.

To make it into a url I did a text formula which combined https://domain name/subfolder name/. combined with the previously constructed text formula and appended the .JPG on the end

As a text formula it’s not clickable BUT can be displayed and copied into an image field that uses get external.image