Hide delete button on document widget

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
kklosson
Posts: 1529
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Hide delete button on document widget

Post by kklosson »

The widget that displays a document attribute has a delete button on it and my users are always hitting it and deleting the document. I have no need for the delete function. Can anyone offer a script to hide it?
Screenshot_1.png
Screenshot_1.png (7.81 KiB) Viewed 5704 times
V8.2 (2721)
MySQL
AWS
idpSteve
Posts: 188
Joined: Thu Jul 27, 2017 6:13 am
Location: Johannesburg, South Africa
Contact:

Re: Hide delete button on document widget

Post by idpSteve »

Try this in the render script:

$("[title|='Remove']").hide();
kklosson
Posts: 1529
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Re: Hide delete button on document widget

Post by kklosson »

Much appreciated but no joy. Should this not be a statement like config.something?
V8.2 (2721)
MySQL
AWS
ACDC
Posts: 973
Joined: Sat Jun 30, 2007 5:03 pm

Re: Hide delete button on document widget

Post by ACDC »

no need for the delete function
Surely you can use PROTECT in some way, to manage this event ?
kklosson
Posts: 1529
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Re: Hide delete button on document widget

Post by kklosson »

Users need to download the current form, complete it, and re-upload it. So must have read/write authority.
V8.2 (2721)
MySQL
AWS
johntalbott
Posts: 586
Joined: Wed Jun 17, 2015 11:16 pm
Location: Omaha, NE

Re: Hide delete button on document widget

Post by johntalbott »

This should work, but it looks like there is a typo.
$("[title|='Remove']").hide();

This will work
$("[title ='Remove']").hide();

It likely doesn't matter as the human eye can't tell the difference, but the options below use a jQuery selector that is a little more specific which in theory will perform better. ...

Hide the button with the X
$("button.k-upload-action[aria-label='Remove']").hide()

Remove the button with the X from the DOM altogether.
$("button.k-upload-action[aria-label='Remove']").remove()
VocalDay Solutions - Agility - Predictability - Quality

We specialize in enabling business through the innovative use of technology.

Services:
-Web/Mobile App Design/Development
-Project Management - Agile, Scrum, Kanban
-Business Analysis
-Testing
kklosson
Posts: 1529
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Re: Hide delete button on document widget

Post by kklosson »

Sadly, none of these options are working. Do these go in the initialization script of the attribute?
V8.2 (2721)
MySQL
AWS
Jaymer
Posts: 1828
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Find Object on Form, Hide or Remove It

Post by Jaymer »

(see post at top of thread for specific case)
Put either in the Render Script of the Form (not Section)

Hide the button with the X
$("button.k-upload-action[aria-label='Remove']").hide()

Remove the button with the X from the DOM altogether.
$("button.k-upload-action[aria-label='Remove']").remove()

--> JaymerTip (example code from John Talbott)
Last edited by Jaymer on Fri Nov 29, 2019 4:45 pm, edited 1 time in total.
Click Here to see a collection of my tips & hacks on this forum? Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
idpSteve
Posts: 188
Joined: Thu Jul 27, 2017 6:13 am
Location: Johannesburg, South Africa
Contact:

Re: Hide delete button on document widget

Post by idpSteve »

The | is unnecessary but won't break anything.

All it does is select elements whose title equals 'Remove' or starts with 'Remove-' similar to how a * or ^ works.

I copied it from some other code which is why the | was there.
kklosson
Posts: 1529
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Re: Hide delete button on document widget

Post by kklosson »

Got it. Works perfectly. Thanks to all.
V8.2 (2721)
MySQL
AWS
Post Reply