1

I want to hide some fields in my Display Form... I was using jQuery:

$(document).ready(function(){
   $("A[name = 'SPBookmark_Start_x0020_date']").closest("tr").hide();
});

But when the page loads, the fields are there.... so the fields are only hidden after javascript executes the code... this is a problem to me... some users CANT see this values...
Is there a way to not load some fields in Display Form?

3
  • From Power Shell Script u can set ShowInDisplayForm Attribute to False. Sep 1, 2014 at 13:35
  • u can set it by SharePoint Manager also Sep 1, 2014 at 13:56
  • Is the actual requirement that only SOME users can't display the fields? This is a mayor point in the solution we should pursue.
    – SPArcheon
    Sep 1, 2014 at 14:05

2 Answers 2

2

It is simple like this.

SPUtility.GetSPField('City').Hide();

Please refer this question to show how to apply it.

Edit:

As far as you are concerned not only on the displaying and having high security concerns over the security of data, you better try something like creating another list with a one-to-one mapping. Then add a lookup column from first list to the second list and move the secured column from first list to second list. Then you can give a restricted permission on the second list. This will be the option as you cannot use SPD or even InfoPath.

9
  • yes this also hides the field... but the values are still there... if users go to html, he is able to see the values... and I dont want that users be able to see the values...
    – Lugarini
    Sep 1, 2014 at 15:56
  • So what if user create a personal view with that column in. He can see values of all the list items ryt? Sep 1, 2014 at 15:58
  • no, users dont have permitions to create views
    – Lugarini
    Sep 1, 2014 at 15:58
  • Great then take the table row which includes the field you have, then set the innerHTML to empty. Still if someone use a tool like Fidler, he can see the response body and find the initial HTML sent. Sep 1, 2014 at 16:02
  • yes, thats what I want to prevent
    – Lugarini
    Sep 1, 2014 at 16:03
1

The answer has already been given.

Either use Powershell to hide the field in Display Form (take a look at another discussion for some helpful guidance or at this page)

#Get the web and site column objects
$web = Get-SPWeb http://site
$column = $web.Fields["Column To hide"]

#Set the PushChangesToLists property for the changes to be applied
#to lists where the column has already been added
$column.PushChangesToLists = $true

#Change the ShowInEditForm and other properties and update objects
$column.ShowInEditForm = $false
$column.ShowInNewForm = $false
$column.ShowInDisplayForm = $true
£column.ShowInViewForms = $true
$column.Update()
$web.Update()
$web.Dispose()

Or Use Sharepoint Manager which is an essential tool for Sharepoint anyway and since it has a Graphical User Interface it is great for beginners too.

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.