By: Kathryn Bartlett
In this example, we have two custom content types based off the Event list content type: (1) “Event Type 1”, with single line text fields “Column A” and “Column B”, and (2) “Event Type 2”, with single line text fields “Column Y” and “Column Z”. Create a Calendar, “Sample Calendar”, and add these two content types to the list. After creating an event of both content types, we see that the add, edit, and display forms all act as we would hope – only columns in that content type appear.
Figure 1 - Add/Edit Event Type 1
Figure 2 - Add/Edit Event Type 2
Figure 3 - View Event Type 1
Figure 4 - View Event Type 2
However, we may not need the Category, All Day Event, Recurrence, or Workspace columns. In this example, we want to remove them from the views. Open SharePoint Designer 2010, open your site, and click on the list. On the right, there is a section for Forms.
Click New… and create a new item form that is and use the content type Event Type 1.
Now this form will appear in the Forms panel.
Click nf1.aspx to edit the form. From the split view, find the table row tags containing the columns you want to delete and remove these lines from the page. Set this as the default New Form page, and create a new Event Type 1 event. Creating an event of Event Type 1, it seems all is set.
However, now when we go to create an event of Event Type 2, we get the same new form as in Event Type 2. We need to create a new form for Event Type 2 in the same way we did for Event Type 1 above.
If we set this new form to be the default, we run into the same issue when we try to create an event of Event Type 1. To resolve this, we need to associate the form with the content type itself, not with the list. Click on the sample calendar in SharePoint Designer. At the bottom left, there is a panel for Content Types.
Click on our content type Event Type 1. On the top right, there is a panel for Forms.
Click the section for New Form to enter the URL of our custom new form, enter the URL, hit Enter, and save your changes.
Do the same for Event Type 2. Now when we try to add an event of each content type, we get the appropriate new forms.
Figure 5 - Custom New Form for Event Type 1
Figure 6 - Custom New form for Event Type 2
Repeat the same steps for the Edit and Display forms to complete the custom views.
By: Kathryn Bartlett