Oli:
I just ran this code and it worked. Note that I have the AddList operation commented out because I wanted to run UpdateList several times to make sure that I could add columns repeatedly.
I just ran this code and it worked. Note that I have the AddList operation commented out because I wanted to run UpdateList several times to make sure that I could add columns repeatedly.
$(document).ready(function() {
//Create list
/* $().SPServices({
operation: "AddList",
listName: "foo",
description: "List created for quiz: foo",
templateID: 100
});
*/
//Add field: Score
var nfields = "<Fields><Method ID='1'><Field Type='Text' DisplayName='DayCount2' ResultType='Text'></Field></Method></Fields>";
$().SPServices({
operation: 'UpdateList',
listName: "foo",
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!");
}
}
});
});