How do you call out looking for an attachment in a catalog client script onSubmit

NadiaR
Tera Contributor
 
6 REPLIES 6

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?

Sumanth16
Kilo Patron

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