Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

How to remove/hide "Bold" option and styling from HTML fields in form?

shivanisutar
Tera Contributor

I am looking for the best practice / recommended approach to restrict or remove the "Bold" text option and bold styling from HTML fields on a form.

Specifically, I want to address two main requirements:

1. Toolbar Restriction: Prevent users from applying bold formatting by removing/hiding the Bold button (and shortcut) from the TinyMCE toolbar on a specific HTML field (or globally if needed).
2. Style / Content Sanitization: Prevent existing `<b>` or `<strong>` tags (or inline font-weight: bold styles) from rendering or saving as bold text inside the field.


- What is the most seamless way to restrict the toolbar button for a specific field without breaking TinyMCE?
- Is there a built-in ServiceNow configuration or HTML Sanitizer setting to strip/ignore bold tags automatically?

Any examples or best practices would be greatly appreciated!

Thanks in advance for your help!

2 REPLIES 2

Tanushree Maiti
Tera Patron

Hi @shivanisutar 

 

You can try with Updating System properties "glide.ui.html.editor.toolbar" as per below mentioned servicenow Documentation .

 

Refer: Configur ing the TinyMCE toolbar via Dictionary attributes 

https://www.servicenow.com/docs/r/platform-administration/tinymce.html

 

Procedure

  1. Navigate to All > System Properties > UI Properties.
  2. Update the Configures the editing toolbar for HTML fields(TinyMCE v6.8.2) (glide.ui.html.editor.toolbar) property to add or remove buttons for the toolbar.
    Note:
    Use a vertical bar ("|") to add a section separator.
     Type Buttons
    Default buttonsbold italic underline undo redo | fontfamily fontsize table | forecolor backcolor link unlink | image media code | alignleft aligncenter alignright | bullist numlist fullscreen
    Available buttonsnewdocument, bold, italic, underline, strikethrough, justifyleft, justifycenter, justifyright, justifyfull, blocks, fontfamily, fontsize, tablecontrols, cut, copy, paste, pastetext, pasteword, search, replace, bullist, numlist, outdent, indent, blockquote, undo, redo, link, unlink, image, cleanup, code, forecolor, backcolor, removeformat, hr, visualaid, sub, sup, charmap, media, preview, fullscreen, accordion
  3. Select Save.
Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Ankur Bawiskar
Tera Patron

@shivanisutar 

on the field dictionary add this attribute and it will disable everything

editor.toolbar=false

AnkurBawiskar_0-1785220022576.png

Output

AnkurBawiskar_1-1785220053353.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader