remove unwanted <p> tag from displaying on widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 08:19 AM - edited 04-17-2024 08:58 AM
Hi,
I have a issue I cannot seem to figure out, I created a widget and this is expected to pull values form. While it works as intended, I have a <p> displaying along with values from that field. How Can I remove this from showing along with the test

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 10:00 AM - edited 04-17-2024 10:02 AM
Hi,
This seems to be that the field you're pulling the value from, is an HTML field, thus is has <p> tags, etc.
You'd want to strip the HTML from it then set the field_value to that scrubbed value which will should resolve your issue.
For example, setting a variable to the replaced version like so:
var string = "<p>example</p>";
var newString = string.replace(/<\/?[^>]+(>|$)/g, "");
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 10:21 AM - edited 04-17-2024 10:22 AM
Hey Allen
Thank you very much on the response but I don't have any variable I can see from my script
var string = "<p>example</p>";
var newString = string.replace(/<\/?[^>]+(>|$)/g, "");
Should I replace field_value = gr.business_case.replace(/<\/?[^>]+(>|$)/g, "");
field_value;
If not to much can you guide me on which I need to replace based on your recommendation please
Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 10:56 AM
Hi,
You do have a variable, you declared it in your g2 evaluate script...it's called field_value. And you're setting this variable to the value of the business case field on the record retrieved from your gliderecord query.
I don't believe you can just add the .replace and so on right to that gliderecord element, which is why I showed an example in my provided script of setting a variable to the value initially, then setting another variable (so you'll need to declare that like you did for field_value) and the previous variable.replace, etc.
Let me know if you're still confused, but it was hopeful my example sort of helped explain it a bit more.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 11:53 AM - edited 04-17-2024 11:57 AM
My head is spinning as I am highly confused. Sorry Allen, this is what I got from your explanation