- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 05:28 AM
Hi,
I have a requirement to make the attachment mandatory on the catalog item. User does not use service portal, so I cannot use "mandatory checkbox" in the catalog. My requirement is to check if the user has attached the file before submitting the catalog. If not, show them error message "Please attach a file".
How can I achieve that?
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 03:10 AM
Hi Anurag,
I used below code in onSubmit catalog client script and it worked for me:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 12:14 AM
Hi,
I am geting below error when trying to use the above code in onSubmit client script:
onSubmit script error: TypeError: Cannot read properties of null (reading 'getElementById'):
function () { [native code] }
Could you please let me know if I am missing anything here?
My catalog item is in a scoped application and I have created a module through which the user will access the catalog.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 01:34 AM
Hi @SK41
Please set Isolate Script to False to make the script suggested by @Anurag Tripathi work as it requires DOM manipulation.
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 02:10 AM - edited 01-10-2024 02:12 AM
It is false only, still getting the error. Could it be because of scoped application?
Do I need to create any other script as well other than onSubmit to make it work?? Right now, I have just created the onSubmit script which @Anurag Tripathi shared.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 02:53 AM - edited 01-10-2024 03:09 AM
Can you show a screenshot of your script?
Here is a sample I tested on
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 03:10 AM
Hi Anurag,
I used below code in onSubmit catalog client script and it worked for me: