Posts Tagged ‘custom content type forms’

Using Different Forms For Different Content Types In A List

July 1st, 2011 Abed Khooli 1 comment

In a document library, you can associate a template for each content type. Lists have forms and you can associate forms for different content types. Out of the box, when you edit a list item, you can also switch between content types if more than one are present (as you do with item properties in a document library). When you select a new (content type) from the list items, there is no indication what content type you are using once you start filling it, and in some case, you do not need to see all fields or just want to re-order them. Let’s make a new form for a custom content type.
In this example, I used the OOB Announcements list. I created a new content type based on the Announcement content type and added one additional site column to it. I added the new content type (called AKAnnouncement) to my announcements list, so for my New Item (ribbon) I have new Announcement and AKAnnouncement.
Open the site in SharePoint Designer and go to Lists and Libraries (under Site Objects, left pane). Click the list (announcements) and in the details page, Forms section, click New and fill the dialog. The name is just the first part of the page filename (the extension is already there) – ex. newak. Leave the radio button as is (new item) and only change the drop down box “select the content type to use” to your custom one (AKAnnouncement) in our case. The file will be added to the list of forms. Click it to open for editing. You can re-arrange or remove items that are not required. In this example, we are just adding a header that show the selected content type (read only). To do this, select the Title row, select Table (data view tools, from ribbon) and select insert above. You should see a row with two cells on top of the Title row. You can merge the two cells if you want, I just put Content Type in the left one and the actual type to the right. Save your form.
back on your list details page, lower left, locate the Content Types section (see screenshot), click your custom type (AKAnnouncement in this case) to see its details page. In the forms section (top right), click the hyperlink next to “New Form” and enter the relative url of your form (ex. /sites/teamsite/Lists/announcements/newak.aspx ) and click the save button on the quick access menu (see screenshot).
Back in the browser, try to add a new item based on your custom content type (AKAnnouncement) and you’ll get your custom form. The original announcement will use the default form.

Categories: Content Types, SharePoint Designer 2010 Tags: