开发者

create list items with jquery

Went to the Jan Tielens' Bloggings: http://weblogs.asp.net/jan/archive/2009/04/10/creating-list-items-with-jquery-and-the-sharepoint-web-services.aspx

I've successfu开发者_如何学Pythonlly adapted his script. Problem is, I want several input boxes.

This piece:

$(document).ready(function() { $("#newTaskButton").click(function() { CreateNewItem($("#newTaskTitle").val()); }); });

   function CreateNewItem(title, Fname) {
        // The CAML to create a new item and set the Title field.
        var batch =
            "<Batch OnError=\"Continue\"> \
                <Method ID=\"1\" Cmd=\"New\"> \
                    <Field Name=\"Title\">" + title + "</Field> \
                    <Field Name=\"FirstName\">" + Fname + "</Field> \
                    </Method> \
            </Batch>";

successfully inputs to the list however the "Fname" field returns undefined"

Any help is appreciated. Thanks


You are not giving it a value, that is why it is undefined.

$(document).ready(function() { 
     $("#newTaskButton").click(function() {
         CreateNewItem($("#newTaskTitle").val(), "FNamesvalue"); 
     }); 
});

This will goe FName the value of "FNamesValue"


This value will return null. because u r passing one parameter.

or do it like this

$(document).ready(function() { $("#newTaskButton").click(function() { 
CreateNewItem($("#newTaskTitle").val(),FNameValue.val()); }); });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜