UserField - Person or Group Column

Aug 12, 2011 at 8:42 PM

I have a userfield (person column) that I need to get the value of to pass to the SPServices call UpdateListItems to insert an item into a list.  How do I extract this value and also tell if the values have been resolved or not.

Aug 13, 2011 at 1:08 AM
This old blog post of mine shows how to set a People Picker. It should give you enough to go on to get a People Picker's value.

Dec 27, 2011 at 6:23 PM

Please help!!!

Sorry for the request right after Christmass but I am hoping someone reads this and can respond

I am on a project with a looming deadline (this week friday 12.30.2011).

I am needing to do something I thought was simple but I have been flailing away at this for two weeks with no end in site.

I am needing to:

1. Get the LoginName of a People Picker Textarea that the user has filled in on a customised "NewFormCust.aspx" page

2. Write that value to a People Picker field in a SP List

I am able to hard code my own Login name into the SP List, but, when I attempt to get the value from NewFormCust I am pulling all the content from "UserField_downlevelTextBox'" and all I need is the login name.

I can see the login name when I alert my variable (it occurs a number of times, the first occurence is inside a "SPAN id=spanDOMAIN\username" and it occurs a number of times as well inside of "UserField_downlevelTextBox").

What jQuery and or SPServices.codplex code can I use to just return "DOMAIN\username" into my variable?

Please see code I am currently using:

var PPValue = STSHtmlEncode($("div[id='ctl00_m_g_59ef03fb_4e98_424b_b194_fc23f4edd835_ff231_ctl00_ctl00_UserField_downlevelTextBox']").html());

function GetUser(PPValue)
 operation: "GetUserInfo",
 userLoginName: "DOMAIN\\myself", (please note I am hard coding my own LoginName so I can test as when I use the value of "PPVlalue" nothing is written to the People Picker Field in the list)
 completefunc: function (xData, Status) {
   $(xData.responseXML).find("User").each(function() {
   curUserId = $(this).attr("ID");
   curUserName = $(this).attr("Name");
   curUserSID = $(this).attr("Sid");
   curUserLoginName = $(this).attr("LoginName");
   curFullUserName = $(this).attr("ID")+";#"+$(this).attr("Name");

   FullUser = curFullUserName;




function CloneUser(FullUser)
//alert("Value Full User on insert: " + FullUser);

        operation: "UpdateListItems",
        async: false,
        listName: "Test",
        updates: "<Batch OnError='Continue' PreCalc='TRUE'>" +
                    "<Method ID='1' Cmd='New'>" +
                        "<Field Name='Control'>" + newID + "</Field>" +
                        "<Field Name='Title'>" + "Test" + "</Field>" +
                        "<Field Name='RevUser'>" + FullUser + "</Field>" +
                    "</Method>" +
        completefunc: function (xData, Status) {
return true;

Thanks to anyone that can help. I have never posted questions to a site before as I have always found answers by trial / error and research...

Dec 27, 2011 at 8:45 PM

I'm no expert in people picker fields... but on quick analysis of the field in IE Debugger and traversing DOM, the following should get you the userID, as long as the user resoved what they typed in (meaning, they clicked the little person+checkmark icon):

$("div[title='People Picker']").eq(0).attr("title")

The code above get's you only the first user name in the people picker... remember that multiple names could have been typed in...  Looks to me that the <div> element will hold not only what SP has been able to validate as being a good userID/Name, but also anything the user types in and anything that SP was unable to resolve (invalid values). The snippet above will give you what has been resolved...

Here is how to get multiple "resolved" userID's from a people picker:

var users = '';
$("div[title='People Picker']").each(function(){
    users += $(this).attr("title");


Hope this help... Good Luck









Dec 27, 2011 at 8:58 PM

Thanks so just to be sure, the page has a total of 5 People Picker Fields on it and I am finding the right one by "id"

So, my actual code would be as below?

var PPValue = $("div[id='ctl00_m_g_59ef03fb_4e98_424b_b194_fc23f4edd835_ff231_ctl00_ctl00_UserField_downlevelTextBox']").eq(0).attr("title");


Dec 27, 2011 at 9:09 PM


You can use the ID, but it needs to be the ID to the <div> area... not the id for textarea element...  in your last post, you seem to be looking for a <div> element using the ID of the text box... Here is the code I think you need, given your last code snippet:

var PPValue = $("div[id='ctl00_m_g_59ef03fb_4e98_424b_b194_fc23f4edd835_ff231_ctl00_ctl00_UserField_upLevelDiv']").eq(0).attr("title");




Dec 27, 2011 at 10:02 PM


You are a LIFE SAVER!!!

Realized that I could get the PP control I needed by setting the correct value in eq() (DUH!!!)

So, your code worked for me!!!!

I should have posted SOOONNNNNERRRR!!!!

Thanks   :0)