SPRedirectWithID causing issue with people picker field

May 25, 2012 at 9:59 PM

I am trying to use the SPRedirectWithID function on my new item form.  The form has a people picker field that stops working as soon as I add the javascript functions for SPRedirectWithID.  I can click on the book icon and search the direcory.  When I select a contact the popup window closes and the field value remains blank.  There is a message in the console that states there is an issue in the core.js and that matches is null or not an object.  When I remove the SPRedirectWithID javascript the error goes away and the field updates correctly.  Am I doing anything wrong?  I placed the following code right under the ASP placeholdermain content place holder tag as shown in the example.  Is SPServices interrupting the people picker field code?

<asp:Content id="Content1" runat="Server" contentplaceholderid="PlaceHolderMain">
<script type="text/javascript" language="javascript" src="../Code/jquery-1.7.2.min.js"></script>
<script type="text/javascript" language="javascript" src="../Code/jquery.SPServices-0.7.1a.min.js"></script>
<script language="javascript" type="text/javascript">
	$(document).ready(function() {
		$().SPServices.SPRedirectWithID({	
			redirectUrl: "NewCase2.aspx",
			qsParamName: "CaseID"
		});
	});
</script>

 

Coordinator
May 30, 2012 at 3:36 AM

Steven:

I haven't seen this behavior in any of my testing. I wonder what else might be going on in your page that might be different than any of mine. Are you using any other JavaScript or jQuery on the page? Does the error occur every time, or only intermittently?

M.

May 30, 2012 at 8:17 PM
Edited May 30, 2012 at 8:17 PM

This is the only custom java on the page to my knowledge.  I do have two datasource controls that are providing data values to two data view dropdownlist fields.  Those values are stored in two separate single line of text columns.  The error happens everytime I load the page.

I am currently using the following: Windows 7, Internet Explorer 8, MOSS 2007, SharePoint Designer 2007

Jun 19, 2012 at 1:15 AM

Is there anything else I can do to get this to work with the people picker field?  The page is a customized list form, no extra java used.  Maybe I am using too new of a version of jquery?

Coordinator
Jun 19, 2012 at 1:57 AM

Can you try using SPRedirectWithID on the non-customized version of the form? Since you've customized it, I have no idea what might be making it act different than I'd expect. If you can get it to work in the non-customized form, then at least we know what the delta might be.

M.

Jul 2, 2012 at 10:24 PM

I created a new ASPX page and added the custom list form to the page.  I selected the list and then selected that it was going to be a new item form.  I added the master page to format the page.  I added the redirect script under the maincontentplaceholder tag.  I opened the page within a new browser and it still has an error updating the people picker field.

 

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; UHG_Win7_Build 11-15-2010)
Timestamp: Mon, 2 Jul 2012 22:22:08 UTC


Message: 'matches' is null or not an object
Line: 5767
Char: 2
Code: 0
URI: http://[sitedomain]/_layouts/1033/core.js?rev=mHKsOQ0iU3Q5jdm9OZNDdg%3D%3D

 

Coordinator
Jul 3, 2012 at 4:31 AM

I'm still not sure what's going on. Can you try taking a copy of NewForm.aspx (I usually name mine NewFormCustom.aspx) and adding the same call to that? What you're doing above may still have markup which varies from the standard NewForm.

M.

Jul 9, 2012 at 9:29 PM

I am also having a slight problem with a people picker field when implementing SPRedirectWithID. The people picker field actually works; it just doesn't behave the way it normally does. If I enter a person and click on the little check gizmo in the people picker field, the name entered doesn't get underlined to verify it. But the name is accepted and I can OK the form and the redirect works. So I can live with that. The redirect with the ID is fanatstic!

Coordinator
Jul 10, 2012 at 2:07 AM

People Pickers can take quite a while to resolve sometimes. You'll can tell if it's still working by hovering over the input box. If you see an hourglass, it's still resolving; if not, then there may be an issue.

I still haven't been able to reproduce this, so any clues would be welcome.

M.

Jul 10, 2012 at 1:23 PM

This morning I removed the script and the CEWP where I had it and just put it on the page after the

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

line as you've suggested elsewhere, but that didn't clear up the slight problem I described above. My NewOrderForm is for a custom list called Warehouse Orders that has four fields on the form:

  1. Requesting Supply Coordinator - A People or Group field that shows Name (with presence).
  2. Division - A lookup field to another custom list.
  3. Phone - A single line of text field.
  4. Building/Room # - A single line of text field.

I have content types enabled on this list, and there's one hidden field on the form (Title, which I renamed to something else). No fields are set as being required. I'm using a modified OrangeSingleLevel.master page.

I don't know if any of these clues will help. And, like I said, the redirect with the ID (in my case OrderID), works very well. I spent all day yesterday looking for a solution to do this that didn't involve hairy SPAPI coding using the SOAP service within LISTS.ASMX (or other things that are a bit over my head). I don't know why I didn't check SPServices earlier in the day, since I use your solutions all the time. Thanks again.

Mar 20, 2013 at 6:57 PM
I am having the same issue. Also occurs when trying to use the RequireUnique function. Error is occuring in the core.js on line 5767 the variable matches is null.
Snippet from core.js

var matches = Array();
function ConvertEntityToSpan(ctx, entity)
{
   if(matches[ctx]==null)
Before the call to SPRedirectWithID the variable matches is set. After the call it is null. Haven't looked into a fix but hope that helps.
Coordinator
Mar 22, 2013 at 5:21 PM
This is an interesting one. matches is a variable SharePoint creates to store the values. Can you show a screenshot of your form? If you could share the list with me, saved as a template, I can try to reproduce it here, too.

M.