1
votes

I'm trying to design a List for our team site to serve as a place for us track work requests from other parts of the organization.

The list has some fields that people from other teams, need not or cannot provide relevant info for. For example, I have a column for % completed, another for who the request is assigned to within my team and so on. I don't want anyone to be able to put in values for any of these fields when they first hit the New button. Is there any way for me to hide these specific fields? If not hide, just disable?

Things I have tried:

Directions from here: http://nickgrattan.wordpress.com/2008/12/02/changing-order-hiding-columns-in-new-edit-forms/ It tells you to enable content type management and that allows you to hide some columns. However this completely hides the columns from all menus. I want those columns to be editable by some specific users though. I want to actually use them, but have them be unusable by outside users.

Note: Unfortunately I have very limited tools for this task due to company policy regarding the intranet. I am not able to write any code, I can't use Sharepoint designer, can't upload any 3rd party solutions and we don't have InfoPath. So basically I'm limited to the web interface and the things I can access as a Site Owner.

3

3 Answers

1
votes

Use SPServices http://spservices.codeplex.com/. Get the current loggedin users group (you can do that using SPServies), if the user is in restricted group execute javascript and hide/disable fields.

You can use content editor webpart and write javascript. There is no need for SPD here.

Update:

You can use the following function:

function DisableField(title){    

var collection = $('td.ms-formbody span').children();

$(collection).each(function(index,object)
{
    if($(object).attr('title').indexOf(title)>=0)
        {
            $(object).attr('readonly',true);
            $(object).css('background-color','#dcdcdc');

        }

});

}
1
votes

Seems to me that the only option, which still doesn't do exactly what you need, is to use javascript in a content editor webpart to hide those fields. However, anyone who knows what they're doing will be able to display them again using the in-browser console.

You could set the "show in newform" option of the field to false using object model, but that doesn't cover showing it to certain users.

To really display the columns only for some users and prevent others from changing the page using JS and enabling them again, you would probably need to make your own ListFieldIterator control...

0
votes

I found a workaround to this that although not perfect, works well enough. Using the initial approach that I took, as noted above, I set the fields that I didn't want other users to see as hidden. They could not be seen in any forms or accessed in anyway through the default views. Then I created a new "admin" view which was a datasheet view and enabled all the columns. So now I can see and edit all the fields in the datasheet based view but they do not appear in the new item form! Hooray!