This project has moved and is read-only. For the latest updates, please go here.

New Item with Content Type Title

Nov 17, 2011 at 4:54 PM

I have created a SharePoint custom list with 8 different content types. When you create a new item, the title on the top is the same. 

I am still working with SharePoint 2007.  

The idea is to make the name of the content type show in the title, so the user knows what they are filling out. This seems easy, but I can't make it work.

I have attempted to use the List Web Services and operation GetListContentTypes.  Help!

Nov 17, 2011 at 11:12 PM

You probably can do what you want without SPServices. Whenever the user changes the Content Type in the dropdown, simply change the page title with your script.

Nov 21, 2011 at 7:57 PM


Thank you for the response!  I have used SPServices.GetQueryString to create the ContentTypeId var. 

Then after creating this var, I use operation "GetListContentTypes".

It will not return the name!

I've attempted to use an alert for trouble shooting and it returns the content type and not the content type.  There was another time where the alert brought back the name of all 8 content types instead of only the one content type showing in the URL. 

I've used the example in codeplex fr GetListContentTypes, but it does not work.  :(






Dec 4, 2011 at 8:39 PM


Did you ever get this working? Sorry I didn't get back to you at the time.


Dec 7, 2011 at 1:14 PM

You could try this code to determine the ID of the item from the URL, then get the content type for this particular item.  From there you should be able to rename your title bar:

// Gets the current item content type from the URL
    var vals = new Object();
    var qs =,;
    var args = qs.split("&");
    for (var i=0; i < args.length; i++) {
        var nameVal = args[i].split("=");
        var temp = unescape(nameVal[1]).split('+');
        nameVal[1] = temp.join(' ');
        vals[nameVal[0]] = nameVal[1];
    var itemId = vals["ID"];
    var contentType;

    operation: "GetListItems",
    async: false,
    listName: "{your list guid in here}",
    CAMLRowLimit: 1,
    CAMLQuery: "<Query><Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + itemId + "</Value></Eq></Where></Query>",
    CAMLViewFields: "<ViewFields><FieldRef Name='ID' /><FieldRef Name='ContentType' /></ViewFields>",
    completefunc: function (xData, Status) {
      $(xData.responseXML).find("[nodeName=z:row]").each(function() {
       contentType = $(this).attr("ows_ContentType");

var newTitle = ("This item is content type: "+ contentType);
Actually, this code requires that the item already exist...i.e. this would work great on an edit form, not so much on a new form...maybe there is something here you can use.
But short of scraping the screen to get the value, I am not sure of how to accomplish this...