4.2. Custom Field Types

Although the out-of-the-box field types supplied with WSS v3 are numerous (see Figure 4-9), they may still be lacking in the sense that they cannot possibly support all of your data entry and validation needs. Surely, there will be a business need for a type of field type that is simply not provided by the WSS v3 framework. WSS v3 allows you to create your own custom fields to support your specific requirements and needs. You can control the custom field's properties and the field's rendering, as well as the field's validation requirements.

In order to create a custom field type, you first need to create a class that represents it. This class must inherit from one of the base field type classes. You must also create a field type definition file that contains the information that WSS v3 needs to correctly instantiate and run the field type. You can optionally include information that defines how WSS v3 should render the field type. This last task is beyond the scope of this book and will not be demonstrated; however, feel free to peruse the SDK and see how easy it is to accomplish.

4.2.1. Custom Field Type Classes

The process of creating a custom field class, as mentioned above, involves inheriting from either the SPField base class or one of the classes in the table showing field type classes supporting inheritance. Although it is possible to inherit from other field type classes not in this list, doing so is not supported. This class will control how ...

Get Professional SharePoint® 2007 Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.