- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2011 10:17 AM
This post actually started out as a question, but as I was typing, I figured out what to do, so now I'm sharing... 🙂
We have an item that requires an attachment in order to fulfill the request, but I was not sure if it was possible to enforce. We could ask the user to confirm there is an attachment, but I could not see how to actually check it with code? Attachments are added to the sys_attachment table and associated with the sc_cart_item table, but there is no guarantee that the attachment is for that particular item, as the record stays around if the item is not actually added to the cart or ordered.
Then that "AHA!" moment struck - just check to see if the list of attachments is visible:
Here's the onSubmit script:
function onSubmit() {
var attachments = document.getElementById('header_attachment_list_label');
if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none' ) {
alert('You must attach at least 1 file before submitting this request.');
return false;
}
}
Solved! Go to Solution.
- 5,570 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2014 01:03 PM
Just setting this answer as correct as the actual thread was not meant as a question and it cannot be changed because it came from the original Community site.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-10-2015 06:09 AM
I like this one, it saves a roundtrip to the server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2015 10:35 AM
Yes, it is definitely nicer to be able to check client side.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2016 09:16 PM
This does not work in the SP.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2018 10:32 AM
I was unable to make the attachment mandatory in the catalog items, I used this script to create a Catalog Client Script, could you help me to make the attachments mandatory by doing a favor?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2019 04:18 PM
Hi! Were you able to make this work? Do you mind sharing your solution?
Thank you!