1

我为页面构建了一个自定义的新表单,并在架构文件中执行了以下操作:

<Form Type="NewForm" Url="NewForm.aspx" WebPartZoneID="Main" />

所以它会寻找我的自定义表单,它适用于我创建的新客户,但系统中已经存在的客户仍然指向标准的新表单

<Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" /> 

因此,我尝试创建一个升级规则,让较旧的规则通过以下方式查看自定义表单:

var list = web.TryGetList("Client Programs");
list.DefaultNewFormUrl = "NewForm.aspx";
list.Update();

但我有一种感觉,这不会做任何事情,有没有办法通过站点设置页面将旧数据指向新的自定义表单,或者我需要在升级规则中添加/更改什么才能使其正常工作?

更新

我还应该提到,在表单的属性中,我已将其更改为在配置单元中查找表单并将其设为元素文件。

谢谢

4

1 回答 1

1

现有项目由 EditForm.aspx 编辑,而不是来自 newform.aspx

您必须复制 newform.aspx 并将其命名为 editform.aspx(可以创建一个 displayform.aspx)。

<Forms>
  <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="features\$SharePoint.Feature.DeploymentPath$\YourProject\CustomDisplay.aspx" UseLegacyForm="True" WebPartZoneID="Main" />
  <Form Type="EditForm" Url="EditForm.aspx" SetupPath="features\$SharePoint.Feature.DeploymentPath$\YourProject\CustomEdit.aspx" UseLegacyForm="True" WebPartZoneID="Main"  />
  <Form Type="NewForm" Url="NewForm.aspx" SetupPath="features\$SharePoint.Feature.DeploymentPath$\YourProject\CustomNew.aspx" UseLegacyForm="True" WebPartZoneID="Main" />
</Forms>

对于每个表单,每个 SharePoint 表单字段都必须使用正确的控制模式进行标记

新表格:

<SharePoint:FormField runat="server" ID="field_YourFieldName" ControlMode="New" FieldName="YourFieldName" />                                

编辑表格:

<SharePoint:FormField runat="server" ID="field_YourFieldName" ControlMode="Edit"                                                    FieldName="YourFieldName" />

显示形式:

<SharePoint:FormField runat="server" ID="field_YourFieldName" ControlMode="Display"                                                        FieldName="YourFieldName" />
于 2013-02-26T11:44:55.233 回答