Frequently when building Sitecore sites, the need has come up for the content author to be able to enter the hours of operation for their business. Unfortunately there is no built-in field type in Sitecore and nothing on the Sitecore Marketplace. With the help of two of my colleagues, Aaron Ladage and Patrick Delancy, we created a custom hours of operation field type. Our type allows content authors to easily enter opening and closing times for each day of the week. The value is stored as XML and can be easily parsed not only to display for website visitors, but also to add the proper microdata and boost the website’s SEO.
Recently the Web Forms For Marketers Module for Sitecore has released support for MVC. With that, lets go over how to create a custom type to be used on your MVC form.
First you’ll need to add a new type under the Field Types folder.
Now in your Visual Studio project, create a new class TermsAgreementField.cs that inherits from CheckBoxField.
Note here that I have made this a required field by making IsRequired always return true.