- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2017 04:02 AM
Hi guys,
I'm new to Servicenow and probably not sure if I'm asking this question correctly so please bear with me.
There's a record producer form in our instance that has a checkbox which only displays when a user selects a particular option from a dropdown list. Therefore, the checkbox is not always available for user inputs so I'm tasked with writing a catalog client script to check if the checkbox is available and if it's available run a specific function. For me to achieve this I want to check if the checkbox is present on the form at the time of submitting and wondering if anyone can show me how this could be done?
My function looks like below at the moment and it's missing the bit that checks for the existence of the field.
function onSubmit() {
var terms = g_form.getValue('u_terms_conditions');
if (terms === false) {
alert('Terms and conditions cannot be empty);
return false;
}
}
Thanks in advance
JD
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2017 04:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2017 04:29 AM
I would replace:
if (terms === false)
with
if (terms)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2017 04:36 AM
Hi Jon,
can you use 'true' instead?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2017 06:14 AM
Thank you both for your swift replies.