getSCAttachmentCount(); function is not working

Pavan S
Tera Contributor

Hi,

 

We have an 'on submit' client script for making the attachment mandatory in portal. 

Even after adding attachment also, the alert is showing like 'Please attach attachements'.

Can anyone help me?

 

We have used the below script 

 

function onSubmit() {

 try {
        var a=g_form.getValue('field_name');
    if (a == "true")
    {

var attachments = document.getElementById('header_attachment_list_label');

if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none' ) {

alert('Please attach attachements');

return false;

}

} catch(e) { 

var count = getSCAttachmentCount();

if(count <= 0) {

alert('Please attach attachements');

return false;

}

}
}

8 REPLIES 8

Hi Anubhav,

 

Yes, we already checked that 'Isolate script' to true only, but we are still getting error

Hi @Pavan S 

The alerts you have written are same could you please check which is one is getting logged.

Please mark helpful/correct if my response helped you.

Hi Anubhav,

 

The second alert we are getting while submitting the form

The Same script is working for Catalog items, but not for order guides.

Currently we need it for Order guide