Scroll bar in widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 06:16 AM
Hi All,
We had a requirement to add a text box on the portal to add the content, for that we are using the Rich text of content publishing, now we want to add a scroll bar or want make the widget flexible so that rich text box will be resized to the amount of content.
Can we add a scroll bar using the instance as we are using the OOB announcement widget and don't want to make any changes on that.
Kindly suggest any solution for this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 06:52 AM
HI @Community Alums ,
I trust you are doing great.
To address this, we can implement a solution that allows you to add a scroll bar to the rich text box without modifying the existing announcement widget. Here's how you can achieve this:
Create a new UI Macro:
Navigate to "System UI" > "UI Macros" in the ServiceNow application.
Click on the "New" button to create a new UI Macro.
Provide a suitable name for the UI Macro, e.g., "RichTextWithScrollbar."
In the "Template" field, enter the following code:
<textarea class="richTextWithScrollbar" style="overflow:auto; resize:none;" onkeyup="this.style.height = '';this.style.height = this.scrollHeight + 3 + 'px'">{{{content}}}</textarea>
Save the UI Macro.
Modify the portal page:
- Go to the portal page where you want to add the rich text box with a scrollbar.
- Edit the page and add a new container or edit an existing container where you want to place the rich text box.
- Add a new widget or edit an existing widget within the container.
- Set the widget type to "UI Macro."
- In the "Macro Name" field, enter the name of the UI Macro created in step 1 ("RichTextWithScrollbar").
- Save the changes to the portal page.
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 11:53 PM
HI @Amit Gujarathi , I am not getting the option to set widget type.
Can you please guide where can I get the option to set type ?