SPRedirectWithID - not redirecting

Nov 9, 2010 at 6:07 PM

Hello,

I have 5 content types that I'd like to chain together with links in the NewForm.aspx. User clicks "save and add new item", "save and add new contact" etc.

When adding SPRedirectWithID with the parent ID, or anything for that matter, the NewForm just routes back to the item list... no redirection takes place, and my other code seems to be voided.

$(document).ready(function() {
	var params = window.location.search.split("%2F");
	var cust = params[4].split("&");
	$("input[Title='custNameEncoded']").val(cust[0]);
	$("input[Title='Customer Name']").val(unescape(cust[0]));

	$().SPServices.SPRedirectWithID({
		redirectUrl: "NewForm.aspx";
		qsParamName: "crID";
	});
});

Any suggestions for how to get the chaining to work properly? The first part of code shown just takes a customer name from the URL and cleans it up. crID is the parent.

Thanks, this is a great library of code!! I'm new to jquery so this really helps
Jason

Coordinator
Nov 10, 2010 at 3:18 AM

Jason:

Glad you are finding SPServices useful. I think I see the problem. You've got semi-colons separating the options you are passing to SPRedirectWithID which should be commas:

$().SPServices.SPRedirectWithID({
  redirectUrl: "NewForm.aspx",
  qsParamName: "crID"
});

M.

Nov 10, 2010 at 2:43 PM

Thanks Marc, can't believe I missed that one considering it was right there in the source doc!

Is there a way to pass additional parameters to the next page over and above the ID? I need to pass a few variables and the content type id onward depending on what the user enters into the initial NewForm.

Jason

Coordinator
Nov 12, 2010 at 2:50 AM

Jason:

I think you'd need to clone SPRedirectWithID and adapt it for your specific needs. Id be interested to hear what you end up doing and how it works.

M.