- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 10:50 AM
Hello,
I'm having issues with my onSubmit catalog client scripts. I creates 2 scripts that will check if urgency or impact is selected, it will stop the submit. After changing and trying to submit, it does nothing when i try to submit. Here is one of the script below. They are the same except for the variable name. Please assist if you can.
function onSubmit() {
g_form.getValue('please_indicate_the_urgency_of_this_outage');
if (g_form.getValue('please_indicate_the_urgency_of_this_outage') == '3');
g_form.addErrorMessage("Please submit the Create Incident form if urgency is Lower Priority");
return false;
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 08:11 AM
Hi @KB30
Can you set UI Type to all and try the following script-
function onSubmit() {
if (g_form.getValue('please_indicate_the_urgency_of_this_outage') == '3') {
g_form.addErrorMessage("Please submit the Create Incident form if urgency is Lower Priority");
return false;
}
return true;
}
It should do.
Regards,
Amit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 11:00 AM
Hi @KB30 ,
You do not need the first line in your code :
function onSubmit() {
g_form.getValue('please_indicate_the_urgency_of_this_outage'); // Delete this line
if (g_form.getValue('please_indicate_the_urgency_of_this_outage') == '3');
g_form.addErrorMessage("Please submit the Create Incident form if urgency is Lower Priority");
return false;
Please mark correct/helpful if my response helped you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 01:43 PM
I tried but when I change the variable to a valid selection, the message still pops up and won't allow me to submit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 11:21 AM
Hi, I think you have a few small formatting errors.
if you are not using formatting in a statement, my understanding is that it can only have 1 line of code, also you end the 'if' statement with ';' before it does anything,
if (g_form.getValue('please_indicate_the_urgency_of_this_outage') == '3') {
g_form.addErrorMessage("Please submit the Create Incident form if urgency is Lower Priority");
return false;
}
and query field content at being of your code, but don't actually assign\use the value. perhaps try something like this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 01:44 PM
Hello Tony,
I tried but when I change the variable to a valid selection, the message still pops up and won't allow me to submit