Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: Odd: Can't add columns to a list

$
0
0

So I'm trying to create a list then add a few fields to it. I've nabbed some code but it's not seeming to work. At the moment the list is created but the new column aint added despite it saying it is. Any thunks?

function createlist() {
 alert('wotcha');
 alert(filename);

 //Create list
 $().SPServices({
    operation: "AddList",
    listName: filename,
    description: "List created for quiz: "+filename,
    templateID: 100
 });
 
 //Add field: Score
    var nfields = "";
    nfields += "<Fields><Method ID='1'><Field Type='Text' DisplayName='DayCount' ResultType='Text'></Field></Method></Fields>";
    $().SPServices({
        operation: 'UpdateList',
        listName: filename,
        newFields: nfields,
        completefunc: function(xData, Status) {
            tp1 = xData.responseText;
            alert(tp1);
            tp4 = tp1.indexOf("errorstring");
            if (tp4 < 0) {
                alert("Fields created!");
            }
            else {
                // Error creating fields!
                alert("Error creating fields!");
            }
        }
    });

 alert('should be doned');
}

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>