O'Reilly logo

Professional SharePoint® 2007 Development by Tom Rizzo, Adam Buenz, J. Dan Attis, Matt Ranlett, Brendon Schwartz, Eli Robillard, Jeff Julian, John Alexander, John Holliday

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required