I am using a Microsoft template for adding Training and Courses for people to register for. Everything is working fine, but I want to add a field to the Courses list. I want to add a field to indicate what type of staff this course is for, eg HR, Health & Safety, Admin, etc.
So I have searched all over for answers to this, the documentation on SharePoint is shocking, and I did the following:
- Settings > Create Column on the Courses page.
- Entered all necessary details
- On DispForm, EditForm and NewForm (.aspx) added
@fStaffType, Staff Type;
toDataFields
section. (Staff Type
is the name of the field`) On DispForm added a new row to display the data:
<tr> <td width="190px" valign="top" class="ms-formlabel"> <H3 class="ms-standardheader"> <nobr>Staff Type</nobr> </H3> </td> <td width="400px" valign="top" class="ms-formbody"> <xsl:value-of select="@fStaffType"/> </td> </tr>
On EditForm and NewForm added a new row to edit/enter data:
<tr> <td width="190px" valign="top" class="ms-formlabel"> <H3 class="ms-standardheader"> <nobr>Staff Type</nobr> </H3> </td> <td width="400px" valign="top" class="ms-formbody"> <SharePoint:FormField runat="server" id="ff12{$Pos}" ControlMode="New" FieldName="fStaffType" __designer:bind="{ddwrt:DataBind('i',concat('ff12',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@fStaffType')}"/> <SharePoint:FieldDescription runat="server" id="ff12description{$Pos}" FieldName="fStaffType" ControlMode="New"/> </td> </tr>
On EditForm and NewForm I get the error:
Error Rendering Control - ff12description_1
An unhandled exception has occured. Object reference not set to an instance of an object.
If I comment out the description it will show the first td
(Field Name) but the second td
is just empty.
Any help would be greatly appreciated!
EDIT: A related problem, don't know if I should create a new question or not. But Marc D Anderson answered below and I was able to add and display a new field. However, I can add a new Course perfectly but if I edit one, and change the Staff Type field, a new Course will be created at the current day and time. But if other fields are edited they edit correctly.
Any ideas?