In this below example, let's say we want to hide the "save & new" button on case edit page layout.
Steps to accomplish this :-
- Create a html area type component on home page. Name it like admin toolbox.
- Keep the component position as Narrow Left column and in the body click on show html.
- Put the below Javascript in the body and save the component.To find the name of button, you can use firebug on firefox or console on any other browser.In this example it is "save_new".
< !--------Wait for the loading of the page--------->
<script type = "text/javascript" >
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(function() {checkCasePage();});
</script>
<!--------/Wait for the loading of the page--------->
<!--------Case Button hide--------->
<script type = "text/javascript" >
function checkCasePage() {
var currentURL = window.location.href;
if (currentURL.indexOf('/500') != -1) {
if (document.getElementsByName("save_new")[0] != null)
document.getElementsByName("save_new")[0].style.display = 'none';
if (document.getElementsByName("save_new")[1] != null)
document.getElementsByName("save_new")[1].style.display = 'none';
}
}
</script>
<!--------/Case Button hide--------->
Now we can add this component to all our home page layouts and see the magic !
This doesn't seem to be working anymore as there is no show html option.
ReplyDeletethis mimic is no where going to work now.
ReplyDeleteneed the javascrpt code to hide custom button on standard page layout
ReplyDelete