SPFindPeoplePicker spins and doesn't resolve

Dec 4, 2015 at 10:32 PM
Edited Dec 4, 2015 at 10:53 PM
I am conditionally populating (Firefox) a people-picker on a custom NewForm.aspx page in SP 2010 Enterprise and spservices 2014.02.

My code will fetch the username, and if it isn't blank, should fill in the username of the current user. But it isn't resolving when the username is inserted.

Also, if I try to edit a form that already has a username present, and I manually edit the control afterward then the box will spin and spin and I can't resolve a manually-entered value. So it rather locks up the box completely.

The below is loaded on a document.ready.
function SetPeoplePickerToCurrentUser(whatDisplayName, overwrite){
    //var currentControlValue = $().SPServices.SPFindPeoplePicker({  peoplePickerDisplayName: whatDisplayName }).row.find("span[class='ms-entity-resolved']").attr("title");    
    var currentControlValue = $("div[title='People Picker']").text().trim();
    if(overwrite || currentControlValue == undefined || currentControlValue == ""){ 
        var currentuser = $().SPServices.SPGetCurrentUser({ fieldName: "Name", debug: false });
            peoplePickerDisplayName: whatDisplayName,
            valueToSet: currentuser,
            checkNames: true
        console.log("SetCurrentUserNameControl fired");
Dec 5, 2015 at 12:58 AM
Edited Dec 5, 2015 at 1:18 AM
Okay, so here is the problem.
Inserting the username causes the page to POST the error: "This Page has been modified since you opened it. You must open the page again.", which, in the ULS is an "System.Web.UI.ViewStateException: Invalid viewstate" error.

This page has a handful of ways to go about solving this; I haven't yet figured out what to do, though.

Unless I can resolve this, the only workaround I can conceive of is filling in a regular textbox and having a sharepoint workflow copy it into the username field. But this is not optimal and I don't want to do it.
Dec 31, 2015 at 2:41 PM
Did you figure this out? You're doing a sort of odd combo of using SPServices and not using it. I can't vouch for you code, but you should be able to both retreive and set the Person or Group field with SPFindPeoplePicker.

Dec 31, 2015 at 3:10 PM
Hi, Mark. sorry! I forgot about this thread when nobody replied...

Well, I found out that I can fill in the people-picker using javascript, IF I don't fetch the username with spservices. Apparently it was the fetching that invalidated the form.

Here is my stack overflow thread: