How to hide buttons on the form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2015 01:57 PM
by default ServiceNow has two set of buttons one set on the top header of the form and one set is bottom of the form. i want to hide bottom set of buttons.
bottom button html code
<button onclick="return gsftSubmit(this);" style="white-space: nowrap" name="not_important" class="form_action_button action_context btn btn-default" type="submit" id="sysverb_update" value="sysverb_update" gsft_id="42df02e20a0a0b340080e61b551f2909">Save & Exit</button>
top header button html code
<button onclick="return gsftSubmit(this);" style="white-space: nowrap" name="not_important" type="submit" class="form_action_button header action_context btn btn-default" id="sysverb_update" value="sysverb_update" gsft_id="42df02e20a0a0b340080e61b551f2909">Save & Exit</button>
any thoughts?
CCing
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2015 03:10 PM
Hi srnewbie,
In older versions of ServiceNow you could toggle the glide.ui.buttons_bottom property to false to hide the buttons. The wiki says this no longer works in UI15 and courtesy of @SNCory on Twitter, it does not appear that there is a native alternative.
This leaves two main approaches:
1. Use a UI Script to select the specific buttons to hide
2. Use a Macro + Formatter to inject css which would look like
.form_action_button {
display: none;
}
.form_action_button.header {
display: inline-block;
}
I personally like #2 though it requires more work (create macro, create formatter for each form, add formatter to each form). Even if you use JS, you are just applying CSS styles in the end anyway so #2 is more direct and will perform better.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2015 08:10 PM
I believe you're referring to UI actions and checking or unchecking the boxes on the UI action control where it's available:
wiki: UI Actions - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2015 11:35 PM
Hi,
The below code is used to hide both top and bottom button based on the name.You can modify this code and archive your requirement.
var items = $$('BUTTON').each(function(item){
if(item.innerHTML.indexOf("Delete") > -1){
item.hide();
}
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2018 02:45 AM
Hi,
I have referred to your script but we found that the above script is not working in the Kingston version, any help on this would be appreciable.
Thanks
Anupama