Disable Edit and Tasks drawer buttons
Best Answer
-
Tom_Hendricks Customer Super IT Monkey ✭✭✭✭✭The quick and dirty way is using JQuery in your custom.js:
In this example, all the buttons except View and Cancel are being hidden from certain users at the bottom of the KB Edit form.// Selectively hide certain buttons $("button.btn.btn-link.btn-lg:has('div'):contains('Edit')").hide(); $("button.btn.btn-link.btn-lg:has('div'):contains('Delete')").hide(); $("button.btn.btn-link.btn-lg:has('div'):contains('Save')").hide(); $("button.btn.btn-link.btn-lg:has('div'):contains('Apply')").hide();
The same idea can be applied to the Edit and Tasks buttons when you are viewing a grid.
//need to add back the View, Cancel buttons $("button.btn.btn-link.btn-lg:has('div'):contains('View')").prop('disabled', false); $("button.btn.btn-link.btn-lg:has('div'):contains('Cancel')").prop('disabled', false);
There are caveats to this approach, but this might be the right balance of simple vs. secure if you are not trying to prevent highly skilled personnel from intentionally tampering (e.g., your main concern is merely your data quality).$("button.btn-link.btn-lg:has('div'):contains('Edit')").hide();
$("button.btn-taskbar.btn-link.btn.btn-lg.dropdown-toggle:has('div'):contains('Tasks')").hide();<br>
I believe this exact code could probably be improved upon or made multi-lingual, of course.
5
Answers
In this example, all the buttons except View and Cancel are being hidden from certain users at the bottom of the KB Edit form.
The same idea can be applied to the Edit and Tasks buttons when you are viewing a grid.
There are caveats to this approach, but this might be the right balance of simple vs. secure if you are not trying to prevent highly skilled personnel from intentionally tampering (e.g., your main concern is merely your data quality).
I believe this exact code could probably be improved upon or made multi-lingual, of course.
Thank You Tom. I'll give it a try.
I will probably not hide "Edit" from the grid view since it is used for KBAs edits.
Same line I can use to hide "Favorites" button while in the RO, correct?
A savvy user could still un-hide them or find a way to execute the underlying functions, but the probability is low and the impact of that happening is also not particularly significant, so this approach should work for most of us.
I assume the two lines that apply to the drawer buttons (Edit and Tasks) need to be wrapped in a fucntion but I can't get those two lines to apply. We want those buttons hidden on all of those screens like TeamWork, My Work, etc. I have this
Has anyone tested this line. I have modified it dozens of ways with no joy.
$("button.btn-taskbar.btn-link.btn.btn-lg.dropdown-toggle:has('div'):contains('Tasks')").hide();
With the assistance of @Patrick_Chambers we have the correct code for use from custom.js. We did not want to hide it globallly so he helped us with that.
@Jeff_Landers
Hi Jeff, could you share the code you used to hide the buttons? I have not been able to get the examples above to work.
Thanks, Chris
@Christopher_Montgome I have been on vacation. Give me a bit to find it and I will post it.
Jeff
@Christopher_Montgome I will take a crack at this. It has been awhile so it will be good for me to go back and document this. Unfortunately, you will have to bear with me as I find all of the pieces. Hopefully, you have a test system to work with but it is easy enough to comment the lines out if you don't get the desired result.
Try ADDING the code in the attached custom.js to your custom js and see if it works. If it doesn't let me know and I will figure out what I missed. Restart the cachebuilder at a minimum but you may need to bounce IIS. The Other file is some additional code you might be interested in
@Christopher_Montgome Here is some other code you may find helpful
@Jeff_Landers
Jeff, greatly appreciated. I will give this a try in my test environment.