Disabling (Hide) Cancel Button

Dear all,

I am trying to disable or hide the cancel button of submitted documents after some time (let’s say three months). Tried the disable_save() method but no luck. Any idea on how to go about?

@kxt5258

If you don’t need Cancel Button. Then simply remove cancel permission from respective Doctype.

1 Like

@Sangram

I do need the cancel button. However, I want to disable cancelling documents which meets certain criteria (like document age, reconciled documents, etc).

@kxt5258

If you want to do this for certain conditions. Then you have to do this using script. Use Jquery to find Cancel Button and hide it.

thanks @Sangram

I was able to do with jquery. However, I was looking for some inbuilt method like disable_save().

@kxt5258

There is no inbuilt method for it.

Please share the method you followed

if(<--your logic here -->) {
        $(document).ready(function(){
                  $("<--target element-->").css("display", "none");
         });
}

Not the most elegant, but ok!

Hi all,
I want to hide action button i tried as per u said but it’s not working for me pls tell me how to hide action button?

this function working
$(“.page-header-actions-block .btn-primary, .page-header-actions-block .btn-default”).addClass(‘hidden’);
$(“.text-right .btn-primary”).addClass(‘hidden’);

Hi,
remove cancel permission for require master from Role Permissions Manager.

You can do it without jquery:

cur_frm.page.btn_secondary.hide()
11 Likes