Widgets

Once the type of data is determined, then it's time to think about how it should look in the form. In CCK lingo, the form elements are called widgets. Do you want a dropdown select list, or a group of radio buttons? Checkboxes or an autocomplete text field? Choose the widget that makes the most sense for the user entering the data. Note that the widgets available will vary based on the field type chosen.

The widget types included in CCK core are displayed in Table 3-2. As with fields, addon modules often expose additional widget choices.

Table 3-2. Built-in CCK widget types Widget type Common uses

Text field This widget allows a single line of text to be entered, such as a name or phone number. Either plain text or formatted text entry is supported.

Text area (multiple Use this widget for entering a larger paragraph of text, such as a biography or a product description.

rows) Either plain text or formatted text entry is supported.

Single on/off Use when something can only be answered "yes" or "no"; for example, a field that asks whether a user checkbox would like to be added to a mailing list.

Checkboxes/Radio Use when there are multiple options to select from; checkboxes will be used for fields that support selecting buttons multiple values, radios for a single value only. In most cases, a "Gender" field makes sense as a radio button selection, whereas a "Favorite colors" field makes sense as a collection of checkboxes.

Select list An alternative to checkboxes and radio buttons is a drop-down select list. Useful when there are many different options to choose from and it would be cumbersome to display each inline as a separate choice.

Autocomplete text This widget displays a text field that, as it's typed into, displays results that start with the letters entered. field Typing "st" would bring up terms like "Stewart," "Studebaker," and "Style." Useful when there are a huge number of options to choose from and displaying them all in a select list would be too much to sort through. However, it requires users to have an idea of what they're searching for.

Was this article helpful?

0 0

Post a comment