Edit.aspx中的Sharepoint条件字段 [英] Sharepoint Conditional fields in Edit.aspx

查看:94
本文介绍了Edit.aspx中的Sharepoint条件字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据字段的值在编辑表单中显示某些元数据字段.

I would like to display certain meta data fields in the edit form based on the value of a fields.

示例:用户将文档上载到Doclib,以得到那里的经理的批准.允许他们更改元数据名称,案例编号,位置,直到项目被经理批准为止.批准该商品后,我想将名称"和案例号"设置为只读.

Example: Users upload a document to the Doclib to be approved by there manager. They are allowed to change the meta data Name,Case No, Location until the item is approved by the manager. Once the item is approved I would like to set Name and Case Number to read only.

满足此要求的最佳方法是什么?

What is the best way to meet this requirement?

如果批准=是 设置名称和案例号=只读 别的 什么都不做.

If approved = yes set Name and Case No = Read only Else do nothing.

我已经尝试了这种方法约5个小时.我认为对于ModerationStatus,这可能会有所不同.可能需要一些特殊的东西

I have tried this method for about 5 hours. I believed this may be different for ModerationStatus. Might require something special

print("<xsl:choose>
<xsl:when test="@_ModerationStatus != '0;#approved'">               
<SharePoint:FormField runat="server" id="ff12{$Pos}" ControlMode="Edit" FieldName="Test_x0020_Session" __designer:bind="{ddwrt:DataBind('u',concat('ff12',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Test_x0020_Session')}"/>
<SharePoint:FieldDescription runat="server" id="ff12description{$Pos}" FieldName="Test_x0020_Session" ControlMode="Edit"/>                      
</xsl:when>
<xsl:otherwise>
     <xsl:value-of select="@Test_x0020_Session"></xsl:value-of>
</xsl:otherwise>

);

我可以将其与其他字段一起使用,但不能与ModerationStatus一起使用.我也尝试将其更改为!='0'和!='Approved'和'0; #Approved'.我在做错什么吗?

I can get it to work with the other fields but not ModerationStatus. I have also tried changing it to !='0' and !='Approved' and '0;#Approved'. Is there something I am doing wrong?

好像卡在了0; #Approved

Seems like its stuck on 0;#Approved

推荐答案

这可以通过SharePoint Designer轻松解决.

This can be easily solved with SharePoint Designer.

  • 您将需要为列表修改 EditForm.aspx
  • 隐藏默认的 ListFormWebPart (请勿删除!)
  • 插入自定义编辑项表单(更多详细信息... )
  • You will need to modify EditForm.aspx for your list
  • Hide the default ListFormWebPart (Do not delete it!)
  • Insert custom edit item form (more details...)

自定义表单的外观与默认表单完全相同,但是您可以使用SharePoint Designer对其进行自定义.以下代码可用于默认的WSS问题列表.当问题状态=已关闭时,它将问题标题显示为只读.

Custom form will look exactly the same as the default one, but you will be able to customize it with SharePoint Designer. The code below can be used for default WSS Issues list. It will show Issue title as read-only when Issue Status = Closed.

<xsl:choose>
    <xsl:when test="@Status != 'Closed'">
        <SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="Edit" FieldName="Title" __designer:bind="{ddwrt:DataBind('u',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}"/>
        <SharePoint:FieldDescription runat="server" id="ff1description{$Pos}" FieldName="Title" ControlMode="Edit"/>
    </xsl:when>
    <xsl:otherwise>
        <xsl:value-of select="@Title"></xsl:value-of>
    </xsl:otherwise>
</xsl:choose>

您可以对自定义列表或/和需求应用相同的逻辑.

You can apply the same logic for your custom lists or/and requirements.

与往常一样,您可能会遇到一些其他问题.我无法在数据视图Web部件中获取@_ModerationStatus的值.我不知道确切的原因...

As usual, you might run to some additional problems. I was not able to get the value of @_ModerationStatus in Data View Web Part. I do not know the exact reason...

这是一个简单的解决方法:

Here is a simple workaround:

  1. 在文档库中创建一列
  2. 在工作流SharePoint Designer中创建新的.

项目更改时将触发,并将批准状态的值复制到新创建的列中.

It should fire when item is changed and copy the value of approval status to newly created column.

您可以将自定义列用于条件格式.

You can use the custom column for conditional formatting.

这篇关于Edit.aspx中的Sharepoint条件字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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