how to disable /Hide the submit button in catalog item for certain condition

String
Kilo Sage

Hi Team ,

We need to disable /hide the submit button when check box is true 

Screenshot 2023-03-11 at 12.08.51 AM.png

 

Please guide me :

 

1 ACCEPTED SOLUTION

Ashir Waheed
Kilo Sage
Kilo Sage

Hi @String 

You can achieve it by using Catalog Client Script on Submit.

 

1. Create a On submit Catalog Client script.

2. Write the script as follow.

AshirWaheed_0-1678475114134.png

3. When the TonerEnabled is checked you can submit the request else you will receive the alert. You can modify the alert or add info message based on your requirements

AshirWaheed_1-1678475194260.png

 

Regards,

Ashir Waheed

 

View solution in original post

5 REPLIES 5

DrewW
Mega Sage
Mega Sage

Have you searched the community posts for this?  Because this one came up in the first 4 or 5.

https://www.servicenow.com/community/itsm-forum/how-to-hide-submit-button-in-catalog-item/m-p/585354

 

Not sure I would recommend DOM manipulation.  Is there a reason you cannot just use an onSubmit script and if the ckeckbox is selected show the user a message about why and then just return false so the form is not submitted?

 

Ashir Waheed
Kilo Sage
Kilo Sage

Hi @String 

You can achieve it by using Catalog Client Script on Submit.

 

1. Create a On submit Catalog Client script.

2. Write the script as follow.

AshirWaheed_0-1678475114134.png

3. When the TonerEnabled is checked you can submit the request else you will receive the alert. You can modify the alert or add info message based on your requirements

AshirWaheed_1-1678475194260.png

 

Regards,

Ashir Waheed

 

This script will not  hide or disable Submit button rite? just alert and abort the submit action.

Ranjith95
Tera Contributor

Hi,

 

You can also try OnLoad client script to hide submit button, here i used DOM

 

I tried below script

 

Applies to : catalog item

Type : OnLoad

Catalog item : select the catalog item you want to hide submit button

Applies on a catalog item view : True

 

script :

function onLoad(){

this.jQuery('button').hide();

}

 

 

Thanks