Archive

Posts Tagged ‘Javascript’

Manipulating SharePoint Lookup Field values using Javascript

May 31, 2011 1 comment

This article gives an small trick for manipulating the values of SharePoint Lookup Field (OOB control for list item lookup). For one of my assignments I was required to manipulate the values listed into SharePoint Lookup Field so I did it in this fashion 🙂

function getField(fieldType,fieldTitle)
{
var docTags = document.getElementsByTagName(fieldType);
for (var i=0; i < docTags.length; i++)
{
if (docTags[i].title == fieldTitle)
{
docTags[i].readOnly = true;
docTags[i].setAttribute(“choices”,”Comment 1|20″);
}
}
return false;
}
getField(‘input’,’Comment Type’);

Categories: General Tags: