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

Tim Deniston
Mega Sage
Mega Sage

From michalc:



$('ATTACHMENT_ELEMENT_ID').hide();



OR



document.getElementById("ATTACHMENT_ELEMENT_ID").remove();



(source: Hide / Disable attachment icon in service catalog)


You will have to replace attachment element id with sc_attachment_button


HI Abhinay/Tim,



None of the suggested code worked. I was able to add attachments even after using   g_form.disableAttachments()


Also, in google chrome when i inspect the paper clip icon i did not find ID attribute to it. May be that's why your suggested code is not working.



find_real_file.png



Error: i guess could not find the element ID


find_real_file.png


That's very odd. When I look at it, the ID is sc_attachment_button. This worked for me:



document.getElementById("sc_attachment_button").remove();


It is not a button in Eureka