Take the 2-minute tour ×

Need some assistance on a bit of JQuery for writing to a MOSS 2007 list. I have the following spot of code. If I run it with just the title field, it works fine, adding additional fields doesn't work. The alert note at the bottom shows Status as success and the newID is undefined.

    operation: "UpdateListItems",
    async: false,
    listName: "Arrest",
                    "<Field Name='Title'>" + title + "</Field>" +
                    "<Field Name='Date_x0020_of_x0020_Arrest'>" + dateOfArrest + "</Field>" +
                    "<Field Name='Subject_x0020_Information'>" + subjectInfo + "</Field>" +
                    "<Field Name='Charges'>" + charges+ "</Field>" +
                    "<Field Name='Significant_x0020_Activity'>" + sigAct + "</Field>" +
                "</Method>" +
    completefunc: function (xData, Status) {
        //get the ID for the newly created Issue
        var newID = $(xData.responseXML).find("[nodeName=z:row]").attr("ows_ID");
        alert(Status + " " + newID);

Date of Arrest is a date field
Subject Information is a multiline note
Charges is a chouce field
Significant Activity is a lookup, and I'm sending it the ID of the item to lookup to.


share|improve this question
I think that James' suggestion is the solution for this issue. Also, check my blog post about the z:row notation: sympmarc.com/2011/02/03/issues-with-spservices-and-jquery-1-5 –  Marc D Anderson Feb 9 '11 at 18:53
add comment

1 Answer

up vote 2 down vote accepted

What's the format of the Date of Arrest string? I needs to be in ISO8601 format, like 2011-02-08T16:42Z (from what I remember) to be added to the list this way, otherwise the whole add operation fails.

share|improve this answer
Ahhh... is there is a SPService util for converting a date into this format? Ot an easy way with JQuery? –  David Lozzi Feb 8 '11 at 21:51
Where's it coming from in the first place? Not sure of a method out in the wild, but you could probably do it with some JavaScript jiggery-pokery. –  James Love Feb 8 '11 at 22:00
Test it with a sample date in that format (hard-coded) first, though, to see if I'm right or wrong. –  James Love Feb 8 '11 at 22:00
(third comment! :O ) Just found this linked on a thread in StackOverflow, a Date library! has a toISOString() method: code.google.com/p/datejs –  James Love Feb 8 '11 at 22:01
add comment

Your Answer


