Hiding the Save button from the HTML interface with Javascript
Hi All,
I´ve been posting about the use of Javascript inserted in a WEBI document.
To insert Javascript code into a webi document just drop a blank cell onto your report, copy the code to it and set its “Read content as” property to “HTML”.
In this blog post I´ll show how to hide a button from the interface, in this case, the Save button.
I´m still working on the general guidelines of scripting WEBI through Javascript but I´m trying to publish as soon as a find out something interesting.
This code will hide the Save button (and its colleague, the “Save as”) :
<script>
wi=window.top.window[2].window[0]._widgets;
for(i=0;i<wi.length;++i)
{if ((wi[i].actionId !== null)&&(wi[i].actionId!== undefined))
if(wi[i].actionId==’saveBtn’)
window.top.window[2].window[0].document.getElementById(wi[i].id).hidden=true;
}
</script>
This is , shortly how it works,
window.top.window[2].window[0] is webiViewFrame, the HTML window of the document,
wi=window.top.window[2].window[0]._widgets;
will get, into wi the list of the widgets of the window (the widgets are, mostly, interactive objects of the interface (like buttons, tabs, etc..)
next step is to transverse the list looking for the Save button , when it´s found, we set the hidden attribute of its html element.
This was tested in SAP BO 4.1 SP5.
Regards,
Rogerio
In WebI 4.1/4.2 you can remove a user's ability to hit the 'Design' button. As it's a right applied to a user/group the restriction applies to all documents a user opens.
At the time of writing, there isn't a way to apply this restriction to a folder/document.
Using the same approach as Rogerio describes above, if you want to hide the 'Design' button for a report, you can using the following javascript.
<script>
parent.document.querySelector('[aria-label="Design"]').style.display = 'none';
parent.document.querySelector('[aria-label="Click here to access Design options"]').style.display = 'none';
</script>