If you want to create folders in a document library here is the workaround. I wrote PreSaveAction() for List Newform.aspx page as fallows.
function PreSaveAction() {
var foldername=$('#ctl00_m_g_1c00635e_b98e_4529_a62d_2890bd7bee4b_ctl00_ctl04_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField').val();
alert(foldername);
$().SPServices({
operation: "UpdateListItems",
async: false,
listName: "Userprofile Library",
updates: "<Batch OnError='Continue' PreCalc='TRUE'>" +
"<Method ID='1' Cmd='New'>" +
"<Field Name='FSObjType'>1</Field>" +
"<Field Name='BaseName'>" + foldername + "</Field>" +
"</Method>" +
"</Batch>",
completefunc: function(xData, Status) {
alert('Folder created successfully');
}
});
return true;
}
No comments:
Post a Comment