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!

4 REPLIES 4

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

@shivanisutar 

Thank you for marking my response as helpful.

Don't go with the system property update as it will impact all the HTML fields in instance.

💡 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

shivanisutar
Tera Contributor

Thank you to everyone who reviewed this!

I was able to resolve this issue by adding a custom dictionary attribute to the HTML field to explicitly define the TinyMCE toolbar options and leave out the Bold button.

Solution:

  1. Right-clicked the HTML field label and selected Configure Dictionary.

  2. Added the following under Attributes:


 
editor.toolbar=blocks | italic underline | numlist bullist | outdent indent | link unlink image table | removeformat

This removed the "Bold" option and other options from the HTML field toolbar. Marking this thread as resolved for anyone else who might need this.