want to disable the Submit button of a record producer of Scoped Application

Himani9
Tera Contributor

Hello All

I want to disable the submit button of record producer with Onload script. The record producer is in a Scoped Application. I can check the id of the button by doing the Inspect element and no exists of submit button. when i am adding the javascript code i.e. document.getElementsByName('submit')[0].disabled = "true"; then it is also giving exception. Can anybody tell me where can i check the code of the SUbmit button and how can i disable the Submit button on load of the form.

Thanks in advance

Regards

Himani Goyal

 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Himani,

what would be the use case of hiding the submit button on record producer? If you hide that submit button then how user can submit it

you can use onLoad client script as below; ensure isloate script is set to false for this onLoad client script

function onLoad(){

document.getElementById("submit_button").style.display  = 'none';

}

find_real_file.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Himani9
Tera Contributor

Hello Ankur

Thanks for the response. I want to hide/disable the submit button based on the condition check in the catalog client script. The Isolate script flag is set to false and i have also tried the above mentioned code in the script but the script is giving some exception so i am not able to achieve the requirement. 

Can you please tell me if this is a scoped application limitation or something else as i have tried this code multiple times earlier in global application but never failed. However now i am not able to hide/disable the button. 

Please help me with any other solution if exists.

Regards

Himani Goyal

 

Hi Himani,

what error it gives in browser console?

below code worked for me in native; set UI type as ALL and isolate script as false

function onLoad() {
   //Type appropriate comment here, and begin script below
   
	document.getElementById('submit_button').style.display  = 'none';
	
}

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Harsh Vardhan
Giga Patron

Using DOM manipulation is not good approach, try to avoid DOM as much as possible,

 

whats your use case ? why do you want to hide it ?