Tags and Identifiers for getTagFromIdentifierAndTitle Function


To find a control in SharePoint from client side Javascript we normally use the getTagFromIdentifierAndTitle function. The function implementation is as below

function getTagFromIdentifierAndTitle(tagName, identifier, title) {
   var len = identifier.length;
   var tags = document.getElementsByTagName(tagName);
    
   for (var i = 0; i < tags.length; i++) {
 	var tempString = tags[i].id;
	if (tags[i].title == title && (identifier == "" || 
          tempString.indexOf(identifier) == tempString.length - len))
        {
           return tags[i];
	}
   }
   return null;
}

Tag is the html tag used to define the control, Identifier is the type of the control and title is the name of the control. Below are basic tag and identifiers of the server side controls.

Control Tag Identifier
Panel div  
Label label  
Button input button
Link Button href  
Hyperlink href  
Image Button input image
Textbox input text
Textbox (Password) input password
Textbox (Multiline) Input textarea
DropDownList select  
Listbox select  
RadioButton input radio
Checkbox input checkbox
File input file
Advertisements

About Rupesh

.NET and SharePoint 2010 developer
This entry was posted in Misc and tagged , , , , . Bookmark the permalink.

6 Responses to Tags and Identifiers for getTagFromIdentifierAndTitle Function

  1. imran says:

    Hi
    What is the tagname and identifier of “hyperlink and picture” field type for “getTagFromIdentifierAndTitle” JAVA Script function

  2. Gary says:

    Rupesh – will this script work for a choice column in a list that allows multiple selections (multiple check boxes)? I have tried several things such as passing in “INPUT” “” “The Column Name”, “INPUT” “checkbox” “The Colum Name”, “INPUT” “” “The Choice Name”, etc., but I can’t get anything to work.

  3. jaswerl says:

    what is the tag and identifier for the date picker

  4. Pingback: Curia Damiano blog | SharePoint: getTagFromIdentifierAndTitle

  5. Johne807 says:

    Thanks for another magnificent post. Where else may just anybody get that kind of info in such a perfect manner of writing? I have a presentation next week, and I’m at the look for such information. ddkagadceebb

  6. Johne432 says:

    Wonderful work! This is the kind of info that are meant to be shared across the internet. Disgrace on the search engines for not positioning this post higher! Come on over and consult with my website . Thank you eeeeekcecbda

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s