Can I use it in a document library?

Nov 18, 2009 at 9:43 PM


I have a Word document library and I would like to populate some data when a new document is created. Can it be done? 



Mar 8, 2010 at 1:11 AM

Hello Alex (& Paul) - Did you ever resolve this ?

Sharepoint is very kind to us by passing through URL parameters when it fires the upload.aspx for documents so that when the edit form comes up it still has the parameter tacked on the URL. Only problem is that the js can't seem to resolve the column name - you step through the javascript and it doesn't return an object to plug the value into. Any idea why ? All editforms are apparently not created equal...



I've also been having a go at adapting the js to work with an Object Picker (I Love Sharepoint's excellent Lookup with Picker) - I can get the ID of the lookup item through but can't get it to execute the check name function to convert the Id to a value - any suggestions here ?

Mar 8, 2010 at 4:06 AM

Further information :

  • the script looks for an element called "part1" in the document in order to find the field to populate. 
  • For a List form (UserListForm template) this can be seen in the template as <SPAN id='Part1'>... From here the script can resolve the input field by its name using jquery.
  • In the template used for the document EditForm (DocumentLibraryForm) , there is no such "Part1" tag and so the script returns a null object at the outset.
May 31, 2010 at 3:40 PM
Edited May 31, 2010 at 3:40 PM

Replace this line:

var f=$("[title='"+k+"']:input", "#part1"),

whit this:

var f=$("[title='"+k+"']"),

And this:

var elm = $("nobr:contains('"+k+"'):first", "#part1");

with this:

var elm = $("nobr:contains('"+k+"')");

that worked for me!! :)