Extended Function getTagFromIdentifierAndTitle to get Fill-In enabled Dropdown

By | January 26, 2010 | 0 Comment
Category: SharePoint

The function “getTagFromIdentifierAndTitle” is used by SharePoint particularly for changing form fields. But it is good enough only if you have straight forward fields. If you have enabled “Fill-in” values, it will not be able to find the correct element. Here is a extended version of this function to get the “Fill-in” enabled field.

function getTagFromIdentifierAndTitle(tagName, identifier, title)
	var len = identifier.length, colonindex, splittitle, taglen, titlelen = title.length, slen;
	var tags = document.getElementsByTagName(tagName);
	for (var i=0; i < tags.length; i++)
		var tempString = tags&#91;i&#93;.id;
		taglen = tags&#91;i&#93;.title.length;
		splittitle = tags&#91;i&#93;.title.replace(title,"");
		slen = splittitle.length;
		if(slen == taglen || (slen > 0 && splittitle.indexOf(":") == -1))
		if ((identifier == "" || tempString.indexOf(identifier) == tempString.length - len))
			return tags[i];
	return null;

About Vishal Monpara

Vishal Monpara is a full stack Solution Developer/Architect with 13 years of experience primarily using Microsoft stack. He is currently working in Retail industry and moving 1's and 0's from geographically dispersed hard disks to geographically dispersed user leveraging geographically dispersed team members.

Leave a Reply

Your email address will not be published. Required fields are marked *