g_form.disableAttachments not working

Bharat23
Kilo Guru

I wrote below script in an onload client script on a catalog item but I still see the paper clip icon. Any ideas??

Running on Eureka patch 11

function onLoad() {

    //Type appropriate comment here, and begin script below

    g_form.disableAttachments();

}

1 ACCEPTED SOLUTION

In Eureka, it is not a button. My script works post Eureka. Use this in your client script



var list=document.getElementsByTagName("img");


for(var i=0; i<list.length; i++){


if(list[i].title=='Attachments...'){


list[i].style.display='none';


}


}


View solution in original post

14 REPLIES 14

In Eureka, it is not a button. My script works post Eureka. Use this in your client script



var list=document.getElementsByTagName("img");


for(var i=0; i<list.length; i++){


if(list[i].title=='Attachments...'){


list[i].style.display='none';


}


}


Thanks Abhinay, it worked


Another interesting thing that i noted was the below error. Some g_form is being recognized in catalog client script. I have used hundreds of times   but never saw this error.



find_real_file.png



I even tried below but didnt work


var g_form=new GlideForm();


    g_form.disableAttachments();


GlideForm is not defined. What exactly you have in client script right now?


Your code is working fine but I am curious to understand as to why g_form.disableAttachments() is not working. It is giving glideform not defined error as shared above.



function onLoad() {


    //Type appropriate comment here, and begin script below


    //var g_form=new GlideForm();


    g_form.disableAttachments();


    //document.getElementsByName("Attachments...").remove();


    //$('sc_attachment_button').hide();


/*


var list=document.getElementsByTagName("img");


for(var i=0; i<list.length; i++){


if(list[i].title=='Attachments...'){


list[i].style.display='none';


}


}


*/


    alert("Attachment disabled...");


}


That is strange. It is working as expected on my instance. Sorry, I really do not know what to say, since it is an out of box object which is not working. Did you make any changes to these UI pages?