2

My project is running an update batch Command via SPServices and I am getting error 0x80020005 in return, but I can't seem to figure out what field or value is throwing the error, so I'm hoping someone can point out to me what I can do to track down the error; I have no idea where to look.

I am using StratusForms (formerly Forms-7).

Here is the StratusForms Save Function:

$.fn.StratusFormsSubmit = function (options) {
    var opt = $.extend({}, {
        listName: "",
        StratusFormsDataField: "StratusFormsData",
        validateForm: true,
        completefunc: null,
        errorOffsetTop: 20,
        errorOffsetLeft: 25
    }, options);
    var $this = this;

    if (gStratusFormsEncrptForm && gStratusFormsDecryptFailed) {
        alert("Cannot save form that was not properly decrypted. Please refresh the form and enter the correct decryption key.");
        return;
    }
    return this.each(function () {

        if (opt.validateForm) {
            if (($this).StratusFormsValidate({
                errorOffsetTop: opt.errorOffsetTop,
                errorOffsetLeft: opt.errorOffsetLeft
            })) {
                saveForm($this, opt.listName, opt.completefunc, opt.StratusFormsDataField);
            }
            else {
                alert("Please fix form errors and re-submit!");
            }
        } else {
            saveForm($this, opt.listName, opt.completefunc, opt.StratusFormsDataField);
        }

    });
};

Here is the StratusForms SPServices function which is serving the error message where I can see the error code:

$.fn.StratusFormsSaveForm = function (listName, formID, StratusFormsValuePairs, saveCompleteFunc) {

        var batchCommand = "New";
    var ID = 0;
    if (formID != undefined && formID != 0) {
        batchCommand = "Update";
        ID = formID;
    }

    $().SPServices({
        operation: "UpdateListItems",
        listName: listName,
        batchCmd: batchCommand,
        ID: ID,
        valuepairs: StratusFormsValuePairs,
        completefunc: function (xData, Status) {
            var errorCode = $(xData.responseXML).find("ErrorCode").text();


            if (errorCode != "0x00000000") {
             /////////////////////////HERE IS THE ERROR CODE I RECEIVE
                alert("An error occurred creating or updating your form. Please check your entries and try again.\r\nerrorcode:" + errorCode); 
                return;
            }
            else if (Status == "Error") {
                alert("Unable to communicate with Sharepoint Server!");
                return;
            }
            //alert(xData.responseXML.xml);
            var newId = $(xData.responseXML).SPFilterNode("z:row").attr("ows_ID");
            if (saveCompleteFunc !== null) {
                saveCompleteFunc(newId);
            }
            //           SaveSuccessful(newId);

        }
    });

}

And here is my call:

function helpdesksubmit(){
    //also passes in the x and y offset of error messages for elements; this allows you to change their location in reference to the form field
    $(helpdesk.EntryFormID).StratusFormsSubmit({
        listName: helpdesk.TicketList,
        errorOffsetTop: 10,
        errorOffsetLeft: 5,
        completefunc: function(id) { 
            alert(thisUserName + ", the save was successful.\r\nRequest ID = " + id);
            loadFormID(id);
        }
     });    
}

How do I track this down?

[update]

So, I am able to CREATE new items, but I cannot update them. In the debugger I can see that the batchCommand is correct, the ID has a correct value, the listName is correct and the valuepairs are loaded. I'm guessing the problem lie with the valuepairs somehow.

pair: Title - one stratus...ices.js (line 314)

pair: ticketcat - Other
stratus...ices.js (line 314)
pair: ticketsubcat - I'm Stuck
stratus...ices.js (line 314)
pair: Description - worksx
stratus...ices.js (line 314)
pair: StratusFormsData - {StratusFormsRepeatable: [],helpdesktitlefield:"one",TicketCategory:"Other",TicketSubCategory:"I'm Stuck",HelpDeskActionSelector:"Edit Existing Ticket",HelpDeskItemSelector:"4",Description:"worksx"};

The only thing that seems out of whack is in the StratusFormsData field - the HelpDeskItemSelector and HelpDeskActionSelector do not send values to the list and so should not really have any data to save in the json field. If these fields do not send/receive data to the list (they are static controls) then they don't need to be saved. I wonder if this is the problem? If so, then this is a bug in StratusForms.

1 Answer 1

1

Okay, I figured out the problem. My underlying list had a field type of "Filtered Lookup". When I deleted this column then speservices was able to submit the data to the other columns just fine. I'm not sure, but maybe it had a "required" flag set on the field.

I never did figure out how to trace what the actual error was in spservices.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.