- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2023 08:01 AM
Hi ,
I m having a catalog item, attachment should be mandatory.
I have set it up in portal settings.
But I want the error message to be displayed like "kindly attach migration document". Please let me know how to customise the error message if attachment is not added while submitting the catalog item
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2023 08:15 AM - edited ‎03-03-2025 12:44 AM
Hello @Priyanka145 ,
Use the below "OnSubmit" client script
and make sure to set Isolate script: False on client script / catalog client script.
function onSubmit() {
if (this.document.getElementsByClassName('get-attachment').length == 0) {
g_form.addErrorMessage('kindly attach migration document.');
return false;
}
}
Regards,
Shyamkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2023 08:15 AM - edited ‎03-03-2025 12:44 AM
Hello @Priyanka145 ,
Use the below "OnSubmit" client script
and make sure to set Isolate script: False on client script / catalog client script.
function onSubmit() {
if (this.document.getElementsByClassName('get-attachment').length == 0) {
g_form.addErrorMessage('kindly attach migration document.');
return false;
}
}
Regards,
Shyamkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2023 08:27 AM
Would you rather prefer "this.document. ..." instead of using ".getValue()":
function onSubmit() {
if (g_form.getValue('get-attachment').length == 0) {
var getName = g_user.getFullName();
g_form.addErrorMessage('kindly attach migration document.');
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2023 05:43 PM
This one worked for me as an alternative to our default error message that displays with the mandatory attachment.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2023 08:19 PM
Hello @Priyanka145 ,
did you get chance to test my solution for your requirement?
Regards,
Shyamkumar