When the number of items in a lookup field exceeds 20, then the control is rendered as an INPUT control by Sharpoint.
Next, lets say you want to disable the lookup field through javascript.
This is straightforward.Isn’t it?
Find the control and set disable=true.
No.
The lookup control looks disabled but if you click over it, a dropdown shows up. Don’t get surprised. Sharepoint aactually inserted an Image button next to the INPUT control, which you have not disabled yet.
The image button on click calls SHOWDROPDOWN function to render the items and show.
So this is how you disable both the controls straightforward,
Just call this function with the title of the lookup field:
like
Disable(“Document Types”);
function Disable(Controltitle)
{
for(var i = 0; i < document.all.length; i++)
{
var firstOne = document.all[i];
if(firstOne.title == Controltitle)
{
firstOne.disabled = true; //INPUT control disabled
if(i < document.all.length - 1)
{
//Image button lies next to the INPUT control and refers to the INPUT control
var secondOne = document.all[i + 1];
if(secondOne.outerHTML.indexOf(firstOne.id) > 0)
{ //This evalautes true since Image button has the lookup field id to call showdropdown function
secondOne.disabled = true;
}
}
break;
}
}
}


