1

Scenario

A list is deployed using the OOB forms. Production data is added. We now need to add a custom form to the list.

The forms are added using this approach:

<Forms>
  <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
  <!- EditForm is now using TestEdit.aspx -->
  <Form Type="EditForm" Url="TestEdit.aspx" Path="testedit.aspx" WebPartZoneID="Main" UseLegacyForm="FALSE"  />
  <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
</Forms>

Source: http://sp2013.blogspot.com/2013/01/sharepoint-2013-list-custom-form.html This approach is how I've successfully been adding forms to a newly created list.

The problem is that when an updated list schema is deployed with the new form references, instead of showing the custom form, a blank modal is shown with a disabled Ribbon. When the list is deleted and recreated, the correct form is shown, but we cannot do this because we need to keep the list data.

Missing form modal

Troubleshooting

Schema Comparing the schema returned by the ExportList method of the URL Protocol

TOP: A working list with custom form. MIDDLE: The broken list. BOTTOM: An OOB list.

<Form Url="Lists/WorkingList/DispForm.aspx" Name="{GUID}" Type="DisplayForm" Default="TRUE" UseLegacyForm="TRUE" FormID="0"/>
<Form Url="Lists/BrokenList/DispForm.aspx" Name="{GUID}" Type="DisplayForm" Default="TRUE" UseLegacyForm="TRUE" FormID="0"/>
<Form Url="Lists/OOBList/DispForm.aspx" Name="{GUID}" Type="DisplayForm" Default="TRUE" FormID="0"/>

Because the custom forms recognize the "UseLegacyForm" attribute, I believe the schema was updated with the reference to the custom form. Something else must be going wrong.

Breakpoint Breakpoints in the code behind of the custom form are not hit. Other breakpoints in the solution are. It seems this form is not being touched.

Not the Solution

These are the things I have already tried. 1. IISRESET 2. Deactivating/reactivating the feature. 3. Recycle app pool. 4. Using a rendering template custom form instead of the approach linked above.

What seems promising is setting the SPList.DefaultNewFormUrl property or SPContentType.NewFormUrl in the feature receiver, but the forms are not rendered properly (example: without a Ribbon).

  • Have you tried adding(attaching to the list) these forms using Powershell? – Amal Hashim Oct 29 '14 at 18:52
  • No. Can you link documentation or an example of this approach? – Jonathan Eckman Oct 29 '14 at 18:53
  • You can also use feature activate event veenstra.xyz/2011/12/09/… – Amal Hashim Oct 29 '14 at 18:59
  • 1
    I see your problem. You're logged in a "System Account" – Derek Gusoff Oct 31 '14 at 16:27
0

My solution was to change my approach to how I was using custom forms so that the form could be attached programatically in a feature receiver. Instead of pointing the list schema to an aspx page with a user control that creates the guts of the form, I pointed it to a Rendering Template. Rendering templates can be set in both the schema and the code. Heres some documentation that helped me set this up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.