Help with onsubmit catalog client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2023 06:40 PM - edited 12-11-2023 06:42 PM
I have a multiple-choice type variable "resource_group" with four choices (A, B, C, D)
The script below should run for three B, C, and D except A. However, the script below runs on all four, and a request is not submitted.
function onSubmit() {
/*** Pop this gem into your script! */
if (g_scratchpad.isFormValid) {
return true;
}
var actionName = g_form.getActionName();
var business = g_form.getReference('resource_group_to_be_updated', getValue);
return false;
function getValue(business) {
if (business.manager.toString() == '') {
alert('cannot submit');
location.reload(true);
return false;
}
g_scratchpad.isFormValid = true;
g_form.submit(actionName);
}
}
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2023 07:01 PM - edited 12-11-2023 07:13 PM
Hi @MR1 ,
Are you sure that you shared correct onSubmit script, in this script only "business.manager" empty check applied which is not matched with problem/issue statement.
Also, try not to use getValue as call back function name because, its used by system as pre-defined method for g_form object.
-Thanks,
AshishKMishra
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2023 07:14 PM
Yes, I shared the correct script.
"resource_group_to_be_updated" is a reference variable and we have another variable called "resource_group".
Based on the resource_group value, this reference field is displayed. If the reference field value manager is empty then abort submission but it is aborting the submission for all values.
We want to run the above script based on the resource_group value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2023 07:57 PM
ok , seems like you didn't share complete information at first place. Follow the @Tai Vu , he is expert.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2023 07:20 PM
Hey @MR1
I've replied in your previous post.
Catalog client Script - Abort the submission of item
Cheers,
Tai Vu