如何在 MOSS 2007 中隐藏新列表项页面中的字段?

发布于 2024-11-19 03:32:49 字数 662 浏览 1 评论 0原文

我正在尝试为我们的团队网站设计一个列表,作为我们跟踪组织其他部分的工作请求的地方。

该列表中有一些其他团队的人员不需要或无法提供相关信息的字段。例如,我有一列表示完成百分比,另一列表示请求在我的团队中分配给谁,等等。我不希望任何人在第一次点击“新建”按钮时能够为这些字段中的任何一个输入值。有什么办法可以隐藏这些特定字段吗?如果不隐藏,就禁用?

我尝试过的事情:

这里的方向: http://nickgrattan.wordpress.com/2008/12/02/changing-order-hiding-columns-in-new-edit-forms/ 它告诉您启用内容类型管理并允许您隐藏某些列。然而,这完全隐藏了所有菜单中的列。不过,我希望某些特定用户可以编辑这些列。我想实际使用它们,但让外部用户无法使用它们。

注意:不幸的是,由于公司有关内联网的政策,我用于此任务的工具非常有限。我无法编写任何代码,无法使用 Sharepoint 设计器,无法上传任何第 3 方解决方案,而且我们没有 InfoPath。所以基本上我仅限于网络界面和我作为网站所有者可以访问的内容。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我也只是我 2024-11-26 03:32:49

使用 SPServices http://spservices.codeplex.com/。获取当前登录的用户组(您可以使用 SPServies 执行此操作),如果用户位于受限组中,则执行 javascript 并隐藏/禁用字段。

您可以使用内容编辑器 Web 部件并编写 javascript。这里不需要SPD。

更新:

您可以使用以下功能:

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');

        }

});

}

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');

        }

});

}
走走停停 2024-11-26 03:32:49

在我看来,唯一的选择(仍然不能完全满足您的需要)是在内容编辑器 Web 部件中使用 javascript 来隐藏这些字段。但是,任何知道自己在做什么的人都可以使用浏览器内控制台再次显示它们。

您可以使用对象模型将字段的“以新形式显示”选项设置为 false,但这并不包括向某些用户显示它。

为了真正只为某些用户显示列并防止其他人使用 JS 更改页面并再次启用它们,您可能需要制作自己的 ListFieldIterator 控件...

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...

我ぃ本無心為│何有愛 2024-11-26 03:32:49

我找到了一个解决方法,虽然不完美,但效果很好。如上所述,使用我采用的初始方法,我将不希望其他用户看到的字段设置为隐藏。它们无法以任何形式看到,也无法通过默认视图以任何方式访问。然后我创建了一个新的“管理”视图,它是一个数据表视图并启用了所有列。因此,现在我可以查看和编辑基于数据表的视图中的所有字段,但它们不会出现在新项目表单中!万岁!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文