This topic is locked
[SOLVED]

Disable Delete Button on Uploaded File

9/7/2022 5:27:41 AM
PHPRunner General questions
I
irwanmoers author

The idea is to keep versioning on the uploaded files, so user still can access edit page but without permission to delete files that already uploaded.
Is there any way to disable delete button or any other workaround to do it?
Thank you in advance

Admin 9/7/2022

The following doesn't make much sense for me - "delete files that already uploaded". How can you delete files that were not already uploaded?

I
irwanmoers author 9/8/2022

I mean files already upload successfully and then user would like to edit the record. By default, in edit page there is Delete button next to each file name. Can we still change/edit other fields but disable Delete button?

Admin 9/8/2022

Yes, it can be done with the help jQuery. Check this article for instance.

This code needs to go to Edit page -> Javascript OnLoad event.

I
irwanmoers author 9/12/2022

Thanks for the clue, but how to know the button ID for this button?

img alt

So far I can see this button is part of item ID "integrated_edit_field1", when I disable this item using Javascript onload events, then the filename list are hidden as well, not only its Delete button.

img alt

Admin 9/12/2022

These two videos can help you figure out how to find a correct selector for this purpose. You might need to use pure jQuery here:
https://www.youtube.com/watch?v=_DmMYRCUtU8
https://www.youtube.com/watch?v=yFnD38oslIc

W
wpl 9/13/2022

irwanmoers,

this worked for me in JavaScript OnLoad:

$("span."+'btn.delete').hide();
I
irwanmoers author 9/14/2022

It works!

Thanks Sergey and Wpl