column not found on page

Nov 20, 2012 at 2:03 PM
when i edit or create folders in sharepoint document library i get an error message column not found click to continue
how do i disable that error message on folder 
Coordinator
Nov 20, 2012 at 3:23 PM

I'm not sure that this is an SPServices question. Can you explain more?

M.

Nov 21, 2012 at 6:32 AM

i have a sharepoint document library which i created cascading columns, they work perfectly

the problem is if users create new folder in sharepoint they get  

error in function

spservices.spcascadedropdowns

parameter

parentcolumn: columnname

column not found on page

click to continue

I am sure its because the column doesnt exist of new folder but it exists when users upload new document

Sharepoint uses the same pages upload.aspx/editform.aspx for folders and documents, i am looking for script to disable the script if users create/edit folder properties so that  the above message will not appear on folders

Coordinator
Nov 21, 2012 at 2:18 PM

If you simply turn off debug mode, your users won't see anything at all.

M.

Nov 21, 2012 at 6:25 PM
Edited Nov 21, 2012 at 7:05 PM

I used to run into Javascript errors when dealing with folders as well.  If all you're doing is some basic SPServices stuff, Marc's suggestion to set the debug to false is plenty sufficient.  I've got some forms that are doind quite a bit of processing on load and on save.  I took it a step further to detect if I'm dealing with a folder or not.  If I am dealing with a folder, I generally don't want all that processing to run.  There's two methods to employ depending on whether you're working with the NewForm.aspx or the EditForm.aspx.

The NewForm.aspx provides an argument in the query string that makes it really easy to know you're dealing with a folder and to subsequently abort...

var qs;

$(document).ready(function() {
  qs = $().SPServices.SPGetQueryString();
  //If this is a folder, don't do anything
  if(qs.Type == 1) return;

  //If we get here, it's not a folder...Do a lot of other stuff
  //...
});

function PreSaveAction(){
  //If this is a folder, don't do anything
  if(qs.Type == 1) return true;

  //If we get here, it's not a folder...Do a lot of other stuff
  try{
    //...
    return true;
  }
  catch(err) {
    alert(err.message);
    return false;
  }
}

The EditForm.aspx doesn't provide this argument but it's easy enough to look up. In the example below, be sure the 'viewName' argument is a view that includes folders. The Query options are set to 'RecursiveAll' so it should get all levels of folders.

var booFolder = new Boolean(false);
var qs;

$(document).ready(function() {
  qs = $().SPServices.SPGetQueryString();
  //If this is a folder, don't do anything
  $().SPServices({
      operation: "GetListItems",
      async: false,
      listName: "List Name",
      viewName: "View Name",
      CAMLViewFields: "<ViewFields><FieldRef Name='ContentType' /></ViewFields>",
      CAMLQuery: "<Query><Where><Eq><FieldRef Name='ID' /><Value Type='Integer'>" + qs.ID + "</Value></Eq></Where></Query>",
      CAMLQueryOptions: "<QueryOptions><ViewAttributes Scope='RecursiveAll' /></QueryOptions>",
      completefunc: function(xData, Status) {
        if($(xData.responseXML).SPFilterNode("z:row").attr("ows_ContentType") == "Folder") booFolder = true;
      }
  });
  if(booFolder == true) return;

  //If we get here, it's not a folder...Do a lot of other stuff
  //...
});


function PreSaveAction(){
  //If this is a folder, don't do anything
  if(booFolder == true) return true;

  //If we get here, it's not a folder...Do a lot of other stuff
  try{
    //...
    return true;
  }
  catch(err) {
    alert(err.message);
    return false;
  }
}