- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎11-16-2023 07:15 AM
I do not want to allow user to press order now until one of the field in catalog item is populated.
I am struggling in client script where I have to only allow users to press order now until few fields gets populated.
How can I do that?
Solved! Go to Solution.
- Labels:
 - 
						
							
		
			Data Acquisition
 
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎11-16-2023 07:22 AM
there are 2 ways to handle this
1) you can use onSubmit catalog client script and check if that variable has value or not.
if not then stop form submission
function onSubmit(){
	if(g_form.getValue('variableName') == ''){
		g_form.addErrorMessage('Please fill the variable before submitting');
		return false;
	}
}
OR
2) You can mark that variable as mandatory always
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
‎11-16-2023 07:22 AM
there are 2 ways to handle this
1) you can use onSubmit catalog client script and check if that variable has value or not.
if not then stop form submission
function onSubmit(){
	if(g_form.getValue('variableName') == ''){
		g_form.addErrorMessage('Please fill the variable before submitting');
		return false;
	}
}
OR
2) You can mark that variable as mandatory always
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
