How do you call out looking for an attachment in a catalog client script onSubmit
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2024 01:24 PM
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2024 10:49 AM
Sure no worries, Your script (the one you've posted yesterday) should work if you replace the "return true" with "return false".
Can you let us know if it worked and mark the thread as "solved" in this case?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2024 09:46 AM
Hi @NadiaR ,
Please try the below catalog client script (onSubmit)
function onSubmit() { if (g_form.getValue('your_variable') == "your_variable_value") { // This is the field value of the question you want to check try { var msg = 'This request requires an attachment. Please review the form and try again.'; var attachments = document.getElementById('header_attachment_list_label'); if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none') { alert(msg); return false; } } //For Service Portal catch (e) { var count = getSCAttachmentCount(); if (count <= 0) { alert(msg); return false; } } } }
Please mark as helpful/correct if it helps.
Thanks & Regards,
Sumanth Meda