- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2023 09:02 AM
Hi All,
can anyone guide me how can we pass variable from client side to HTML in UI Pages?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2023 01:01 AM
So, if the reason for why you want to get the contents of the <p/> element is to remove the HTML tags, that is not how it should be done.
You just need to enclose the phase 1 interpolation (${...}) within a <g:no_escape/> tag:
<p><g:no_escape>${ content }</g:no_escape></p>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2023 09:42 AM
What kind of variable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2023 12:44 AM
Hi,
I have created a UI page and our requirement is to get the field value(HTML type field) in the UI Page,but when we are simply gliding the table and getting the HTML field value ,its coming with the tags(<p> <strong>this is an example</strong></p>) but we want the values without the tags
I tried using regex:
var gr=new GlideRecord("abc");
gr.addQuery('sys_id', '${sysparm_sys_id}');
gr.query();
while(gr.next()){
var regex = /( |<([^>]+)>)/ig;
var content =gr.getValue("html_field").replace(regex, " ");
}
now here problem is how can pass this content from Client side to HTML in UI page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2023 01:01 AM
So, if the reason for why you want to get the contents of the <p/> element is to remove the HTML tags, that is not how it should be done.
You just need to enclose the phase 1 interpolation (${...}) within a <g:no_escape/> tag:
<p><g:no_escape>${ content }</g:no_escape></p>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2023 05:03 AM
This was really helpful.
Thank you