Wednesday, March 21, 2007

SharePoint V3: Configuring Custom NewForm.aspx, EditForm.aspx, DispForm.aspx

NewForm.aspx, EditForm.aspx, DispForm.aspx represent the web pages that the SharePoint user sees when they click the New , Edit, or Display actions from a custom list web part tool bar, or from an "Linked to Edit Item" drop down.

In SharePoint deployments, it is fairly common to have a requirement to override these pages with custom pages. You would want to do this when you want to hide fields from a user, or when you want to enhance the appearance of the page for the user.

One example of where I needed to do this is on a custom list where I had configured a SharePoint Designer workflow. The workflow was fairly complex and I had configured some extra fields on the custom list to facilitate the workflow. I didn't want the users to see these extra fields when they were creating, editing, or viewing items in the list so I had to hide these fields.

Here are the steps to configuring custom NewForm.aspx on an existing custom list. These steps may also be used to configure custom EditForm.aspx or DispForm.aspx.

* SharePoint Designer > File > Open Site
* Expand the lists folder
* Expand the custom list that you are modifying
* Double click NewForm.aspx to open it
* File > Save As
* Name the custom list something unique (do not overwrite the default NewForm.aspx) e.g.
* NewFormCustom.aspx
* You will see a generic SharePoint control in the center of the page with column 1, column 2, column 3
* Right click the SharePoint control that is in the center of the NewFormCustom.aspx page, Cut to remove it from the pageInsert > SharePoint Controls > Custom List Form
* Right click within the Custom List Form SharePoint control to invoke the menu.
* Modify the Custom List Form SharePoint control.
* File, Save
* Right click the custom list container > Properties
* List Properties > Supporting Files Tab > Configure this tab accordingly, pointing NewItemForm to NewFormCustom.aspx
* Apply, OK
* File, Save

If you need the revert back to the original NewForm.aspx, you can open the list properties from SharePoint Designer, navigate to the Supporting Files tab, and point the NewItemForm property back to NewForm.aspx. Furthermore, if the requirements change, the original NewForm.aspx is still in tact and you have the option to create additional, custom NewForm.aspx pages.

Words of caution about working with the NewForm.aspx, EditForm.aspx, and DispForm.aspx:
* Always create a web part template of the custom list or document library as a backup, before making changes
* If the custom list or document library has workflow, take the additional step of creating a site template or backup the site collection entirely using stsadm
* Never rename the default NewForm.aspx, EditForm.aspx, or DispForm.aspx pages. This will corrupt the custom list. When you click on Edit Item you will receive an error, "Invalid URL." Instead use the steps above.
* After switching to the custom form, attachments are no longer supported on the custom list. If you try to add an attachment you will get an error, "This form was customized not working with attachment."


UPDATE:

Microsoft published a knowledge base article addressing the attachment issue:

Microsoft KB 953271:
Error message when you try to attach a file in a custom form on the Web site in Windows SharePoint Services 3.0: “This form was customized not working with attachment"
http://support.microsoft.com/kb/953271

18 comments:

  1. Anonymous6:14 AM EDT

    I find it strange that attachments won't work after creating a custom form. There seem to be a solution available, but it doesn't work for me.

    ReplyDelete
  2. Anonymous8:26 AM EDT

    Hi,
    Do you know why the page is not changed after you do
    * List Properties > Supporting Files Tab > Configure this tab accordingly, pointing NewItemForm to NewFormCustom.aspx

    It's still NewForm.aspx.

    ReplyDelete
  3. Yes, on the list properties screen where you change from newitemform to newformcustom.aspx, make sure that the Content Type Specific Fields drop down is set to "Item" and not "Folder."

    Nick

    ReplyDelete
  4. Anonymous3:33 AM EDT

    My Attach File button is not working anymore. I received the same Error Message: "This form was customized not working with attachement."

    ReplyDelete
  5. Anonymous4:49 PM EDT

    How do this without using office designer

    ReplyDelete
  6. Anonymous11:17 PM EDT

    Hi,

    I managed to curropt my lists . How can I restore the site back to its original uncorrupt state...

    Thanks,
    Sam

    ReplyDelete
  7. Restoring site...do you have either a site collection backup or a full farm backup?

    ReplyDelete
  8. Anonymous8:00 AM EDT

    when doing this for displaying the form,

    why will the attachement file not display and also dissappears from the datasource.

    i have followed this through to create a DispForm, however i cannot get it to display the attachment.

    any pointers?

    thanks in advance

    ReplyDelete
  9. Anonymous10:41 AM EDT

    Hi
    I'm having the same difficulty in setting the page of the customised page in the properties tab in Sharepoint Designer.
    For some reason my content type specific forms shows the name of the list in the dropdown and not 'Folder' or 'Item' so it always refreshes back to the original newform.aspx when I return to the properties.
    The only difference I can see is that my list is within a meeting workspace, is this an issue?

    Also how can I add the new form to a production site and set it as the default, without using Sharepoint Designer?
    Thanks

    ReplyDelete
  10. Anonymous12:07 AM EST

    Thanks very much - this worked perfectly!

    ReplyDelete
  11. Hey Mate,

    Thanks heaps for this work around! Worked a treat! (Alot better then the microsoft site's way of doing things)

    One thing to keep in mind guys, when doing this, make sure it creates the custom list form in the web part zone otherwise it wont work.

    ReplyDelete
  12. Anonymous5:11 PM EDT

    Hi Nicholas,

    Great post.Can you please post how to customize the appearance of the New form.aspx .I am frustrated with the sharepoint look of the constant lengths of the fields and not able to group.

    I tried but could not overwriet the css classes for eg: msbodyform,msbodylabel..

    please advise.

    Thanks,
    Sub

    ReplyDelete
  13. You can get your attachment view features back by doing the following: http://support.microsoft.com/kb/953271

    ReplyDelete
  14. You can get Attachment Features back. This method worked for me.
    http://support.microsoft.com/kb/953271

    ReplyDelete
  15. I do not see or get the options described here. I am on SPD v.12.0.6320.5000.

    * Right click within the Custom List Form SharePoint control to invoke the menu.
    * Modify the Custom List Form SharePoint control.
    * File, Save
    * Right click the custom list container > Properties
    * List Properties > Supporting Files Tab > Configure this tab accordingly, pointing NewItemForm to NewFormCustom.aspx
    * Apply, OK
    * File, Save

    ReplyDelete
  16. Anonymous2:52 AM EDT

    Thanks for the brief steps.

    ReplyDelete
  17. Many institutions limit access to their online information. Making this information available will be an asset to all.

    ReplyDelete
  18. Anonymous5:46 PM EST

    Works Great!!! Tanks!!

    ReplyDelete