UpdateListItems ValuePair doesn't take numbers in 0.6.2

Jul 12, 2011 at 1:30 AM

I encountered a problem when upgrading to 0.6.2 for UpdateListItems where the value for valuepairs cannot be a number anymore. I would get a javascript error message "Object doesn't support this property or method" that points to s.replace. To get UpdateListItems to work, I had to change my number values to strings. After reading the discussion board the s.replace was an update in 0.6.2 to escape special characters. My question is will future releases allow UpdateListItems to use numbers as values in valuepairs? Or just all values from now on need to be strings?

Thank you.

-Bernard

Coordinator
Jul 12, 2011 at 11:27 AM

Bernard:

That would be an issue. Can you give an example?

M.

Jul 12, 2011 at 8:18 PM

I followed examples of parent/child lists where the child list contains a column that holds the ID of its parent in a number column. For this example WidgetId is that Number column and message is just a text column.

When I call CreateNewItem(4, "test"), I get the error message mentioned above. If I call CreateNewItem("4", "testtest"), it succeeds and a new item is added to the child list.

function CreateNewItem(widgetId, message) {
	$().SPServices({
		operation: "UpdateListItems",
		async: false,
		batchCmd: "New",
		listName: "WidgetItemMessages",
		valuepairs: [["WidgetId", widgetId], ["Message", message]],
		completefunc: function(xData, Status) {
			var out = $().SPServices.SPDebugXMLHttpResult({
				node: xData.responseXML
			});

			$("#WSOutput").html("").append("<b>This is the output from the GetList operation:</b>" + out);
		}
	});
}

Hope this helps with the issue.

-Bernard

Coordinator
Jul 13, 2011 at 1:31 PM

Thanks, Bernard. It didn't occur to me to test for the value type. (Bad coding on my part.)

I've got a fix in v0.6.3ALPHA4, which I will post momentarily. I'd appreciate it if you could test it for me.

M.

Coordinator
Jul 13, 2011 at 1:32 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Sep 10, 2011 at 2:26 AM

I can confirm that this works in 0.6.3 Alpha 6 as I'm working on a script that adds new fields, one being a number field.  It fails in 0.6.2 and succeeds in the Alpha.