How do you remove HTML <p> formatting from form field?

MBarrott
Mega Sage

I have a description field on demand task form. Users can input a description from the Create a Demand catalog item.

 

The issue I'm seeing is that the data they provide is coming in within <p></p> HTML on either end (see screenshot)

 

Is there a simple solution to remove these tags?

1 ACCEPTED SOLUTION

swathisarang98
Giga Sage
Giga Sage

Hi @MBarrott ,

 

Could you please refer the below article ,

write after insert BR with reference of below article
https://www.servicenow.com/community/developer-forum/script-catalog-items-description-to-request-wit... 

 

 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

 

View solution in original post

7 REPLIES 7

Happy to see your reply, that it works for you. 

Please mark as accepted solutions.


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Sumanth16
Kilo Patron

Hi @MBarrott , 

 

 

You can add system property by referring to the below thread:

 

Create a new system property with the name:

glide.ui.escape_html_list_field property

Update value = false

 

https://www.servicenow.com/community/architect-articles/how-to-remove-the-html-tag-in-the-list/ta-p/...

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda

Ayushi12
Mega Sage

Hello @MBarrott ,

Please use regex. Something as below to remove the HTML tags and then set the value in field.

 

var desc=current.yourhtmlfieldname;
desc= desc.replace(/<\/?[^>]+(>|$)/g, "");

Please mark my answer as correct based on Impact.