Module Monday: Select or Other

How to Create Custom Input Widgets for FieldAPI Text Fields

Drupal's FieldAPI (called 'CCK' in Drupal 6) gives site builders a great set of tools for customizing node editing forms and other input screens. Even for simple text fields, it provides a set of useful widgets like select boxes and radio buttons for choosing between existing options, and text fields for entering in custom values. If you need both of those at once, however -- a list of canned options, and the ability to enter in a custom value as well -- you're out of luck. Unless, that is, you install Select or Other module.















Choosing the Select Or Other widget

Select Or Other provides a handful of custom input widgets for CCK and FieldAPI text fields. Like the default select and radio button widgets, it uses the list of "Allowed Options" for the field to populate the select list or radio buttons a content creator chooses from. Unlike the default widgets, however, these provide a configurable "Other..." option in the list as well. When it's selected, a free input text area appears and content creators can add their own text, even if it's not in the list of allowed options.

The beauty of this module is its simplicity: no changes are made to the structure of your fields, and there are no strange interactions with the field's display formatters or data storage.















The widget in action

Select or Other is available for Drupal 6 and 7, and has a solid track record with very few bugs. It also supports the WebForm module, and exposes a custom FormAPI element to developers looking to build their own input forms from scratch. If you're looking to add a bit of extra flexibility to your site's text fields and select boxes, it's worth a look!

Get in touch with us

Tell us about your project or drop us a line. We'd love to hear from you!