This project has moved and is read-only. For the latest updates, please go here.

Not able to save multiline listitem into sharepoint 2007, using UpdateListItems.

Jul 29, 2011 at 8:13 AM
Edited Jul 29, 2011 at 8:23 AM


what i did: I have created Custom_editform.aspx.

                In that i am using Custom_Save button to save the data in to SP list.

                i have a multiline text box field , but this is a html field , not the usual mutliline of sharepoint--> Other Details

Problem:in the Custom_editform.aspx while saving using custom_save_buton, only Other Details is not getting saved, and throwing error which is stopping entire page from executing. when i  delete code to save this 'other details'  field rest of the page works fine. Can anyone guide me please.

Thanks in advance,

My Save code:

Note: 'byName' gets the ID of the record from the URL. its working fine.

operation: "UpdateListItems",
async: false,
                webURL: "   valid url ",
                listName: "Employee",
                updates: "<Batch OnError='Continue'>" +
                                    "<Method ID='1' Cmd='Update'>" +   
                                    "<Field Name='ID'>" + byName + "</Field>" +
                                    "<Field Name='Name'>" +    $("#ctl00_PlaceHolderMain_g_78c6c890_a453_448f_a5bb_09bbae960704_ff4_1_ctl00_ctl00_TextField").val() + "</Field>" +
                                    "<Field Name='Profile'>" +    $("#ctl00_PlaceHolderMain_g_78c6c890_a453_448f_a5bb_09bbae960704_ff7_1_ctl00_ctl00_TextField").val() + "</Field>" +
                                    "<Field Name='Additive'>" +    $("#ctl00_PlaceHolderMain_g_78c6c890_a453_448f_a5bb_09bbae960704_ff6_1_ctl00_ctl00_TextField").val() + "</Field>" +
                                   "<Field Name='Author0'>" + document.getElementById('ctl00_PlaceHolderMain_g_78c6c890_a453_448f_a5bb_09bbae960704_ff22_1_ctl00_ctl00_TextField').value + "</Field>" +
                                   "<Field Name='Activity_x0020_Type'>" + SelectedActivityType + "</Field>" +                                  
                                   "<Field Name='Other_x0020_Details'>" + document.getElementById('ctl00_PlaceHolderMain_g_78c6c890_a453_448f_a5bb_09bbae960704_ff10_1_ctl00_ctl00_TextField').value + "</Field>" +
                                    "</Method>" +
                 completefunc: function (xData, Status) {
                           alert("Data saved");

Jul 29, 2011 at 1:29 PM

It's not clear what version of SPServices you are using, but I'm almost positive you are running into an issue with the characters you are trying to save in your Multi-Line Text field.  These characters are reserved.


They need to be escaped properly before sending them into your web service call.  If I'm not mistaken, Marc added this as a fix in a newer version of his library.  If you can't upgrade, then you can use an OOTB SharePoint JavaScript function: STSHtmlEncode.  So you would wrap your value with this function:

STSHtmlEncode( $("textarea[title='Other Details']").val() );

Try that out and let us know if that was causing the issue.


Dec 14, 2011 at 9:46 PM

That's a great hint, Matt. It was exactly what I was looking for! :)