Hide catalog form submit button and hide catalog form fields based one variable drop-down

msc
Tera Contributor

Hi Everyone,

 

I have requirement that I need to hide the form fields and submit button based on the catalogue variable drop-downchoice value.

 

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@msc 

hiding dynamically the submit button will require DOM manipulation which I won't recommend.

Please use onSubmit catalog client script and stop the form submission

function onSubmit(){
	var val = g_form.getValue('variableName');
	if(val == 'choice 1 value' || val == 'choice 2 value'){
		alert('You are not allowed to submit');
		return false;
	}
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

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