Sharepoint 10 列表:想要限制每个用户组的表单字段 [英] Sharepoint 10 Lists: want to limit form fields per user groups

查看:46
本文介绍了Sharepoint 10 列表:想要限制每个用户组的表单字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 SharePoint 10 列表功能创建服务请求票务系统.我想在完成表单时对最终用户隐藏一些表单字段,但希望管理员看到所有表单字段.一个示例是隐藏分配给:"表单字段表单最终用户.不知道如何做到这一点.提前致谢.

I am creating an Service Request Ticketing System using SharePoint 10 Lists functionality. I want to hide some form fields from the end user when completing the form but want the admin folks to see all the form fields. One example would be hiding the "Assigned To:" form field form end users. Not sure how to do this. Thank you in advance.

推荐答案

下载 JQuerySPServices 库并将它们放置在只读文档库或您的 14 Hive 中,以适合您的方式.然后编辑列表的 NewForm.aspx(使用 SP Designer)并添加对这两个文件的引用.

Download JQuery and SPServices libraries and place them in a read only document library or in your 14 Hive, whichever suits you. Then edit the NewForm.aspx of the list (with SP Designer) and add in references to the two files.

添加具有以下内容的脚本标记:

Add a script tag with the following:

$(document).ready(function() {
    Admin_Group = "My Group Name";
    if(IsGroupMember(Admin_Group))
    {
        $('input[title="Assigned To"]').parent().parent().css("display","none");
    }
});


function IsGroupMember(GroupName)
{
    var isGroupMember = false;
    $().SPServices({
            operation: "GetGroupCollectionFromUser",
            userLoginName: $().SPServices.SPGetCurrentUser(),
            async: false,
            completefunc: function(xData, Status) {
              if($(xData.responseXML).find("Group[Name='" + GroupName + "']").length == 1)                
              {
                  isGroupMember = true;
              }
            }
    });
    return isGroupMember;
}

您可能需要检查输入选择器是否正确访问了assignto 或您需要隐藏的任何字段,但我在许多情况下成功地使用了这种方法.确保您隐藏的字段不是必填字段.如果您需要,也请记住将其隐藏在 EditForm.aspx 中.

You might need to check the input selector is correctly accessing the assignedto or what ever field you need to hide but I've used this approach successful in many situations. Make sure the field you hide isn't a required field. Also remember to hide this in the EditForm.aspx too if thats what you need.

这篇关于Sharepoint 10 列表:想要限制每个用户组的表单字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆