0

I'm trying to add HTML content into a Multiline Text field (Enhaced Rich Text).

When I set field to pure string, the field is updated:

    $().SPServices({
        operation: "UpdateListItems",
        async: false,
        batchCmd: "New",
        listName: "LIST",
        valuepairs: [["scTabela", "OLA"]],
        completefunc: function (xData, Status) {          

        }
    });

But when I set field to html, no error occurs, but the field is not updated. Field stay blank.

    $().SPServices({
        operation: "UpdateListItems",
        async: false,
        batchCmd: "New",
        listName: "LIST",
        valuepairs: [["scTabela", "<p>Olá</p>"]],
        completefunc: function (xData, Status) {          

        }
    });

I don't know what I'm doing wrong. Anyone can help me?

2 Answers 2

4

Use below:

var value = SP.Utilities.HttpUtility.htmlEncode(html);

$().SPServices({
    operation: "UpdateListItems",
    async: false,
    batchCmd: "New",
    listName: "LIST",
    valuepairs: [["scTabela", value]],
    completefunc: function (xData, Status) {          

    }
}); 
0

Create one div in your html and take input from user. Div will allow user to input rich content.

Then after write code below:

var divContent = $('#divInputText').html();

$().SPServices({
    operation: "UpdateListItems",
    async: false,
    batchCmd: "New",
    listName: "LIST",
    valuepairs: [["scTabela", divContent]],
    completefunc: function (xData, Status) {          

    }
});

Your Answer

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

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