0

I have a field in my list that I would like to hide on the initial upload of the document, but not when the user tries to edit the properties of the document later. For example...

  1. User uploads document
  2. User edits metadata for first time (field not visible).
  3. User saves document

At a later date....

  1. User edits document properties (field is available).

Is there a way to do this somehow? Maybe using jquery and URL parameters? I tried setting the spfield.hidden property however that appears to do it for the whole list and not the specific listitem.

4 Answers 4

1

You can create a custom NewItem Form using SharePoint Designer and hide your field on it, that way it will still be visible on your edit item form but not on your new item form, here is a related answer.

1
  • Unfortunately this is the editform that is showing. If it were on the newitem form then this would be a lot easier, for example setting the field.ShowInNewForm property to false.
    – BlueBird
    Commented Oct 10, 2013 at 14:02
1

You can hide the field using JQuery. Assume that the field name is Feedback. The follwing JQuery code will hide the field in the form:

var feedbackField = $("input[title=Feedback]");
feedbackField.parent().parent().parent().hide(); 

Source: http://sharepointnadeem.blogspot.in/2011/09/hide-sharepoint-list-field-based-on.html

4
  • I understand that, but how would you determine if this was the initial upload or not.
    – BlueBird
    Commented Oct 10, 2013 at 14:00
  • If you try to go with event handler code the property properties.AfterProperties["vti_contenttag"] is null in case when users upload a new document otherwise a value will be found sharepoint.stackexchange.com/questions/47363/… Commented Oct 10, 2013 at 14:14
  • You could add some more javascript to Nadeems suggestion, check if the Modfied date equals the Created date. Then it should be the first time he edits? Maybe Im wrong here :) Commented Oct 10, 2013 at 16:57
  • Yea it will be the first time they edit, but won't change unless the document is actually modified.
    – BlueBird
    Commented Oct 11, 2013 at 16:13
1

The problem is, so far as SharePoint is concerned, it is a "new" item when you select the document and upload it, and then when you actually go to set the field values you are updating the existing item.

You may be able to get creative by setting a hidden property in an event receiver on the first update and then reading that in JQuery, or implementing logic based on creation date, etc.

0

Turn on versioning (if not needed, just restrict to max 1 verson). Check to ensure the doc is at v1 using jQuery/SPservices etc. Hide the field if version is equal to 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.