Setting the playing field
To help you tailor your hub to your needs, hub resources enables you to add custom fields in addition to the built-in fields. So, how do you extend the compose resource form with a custom input field?
Where to go
Custom fields can be added to any major resource type via the administrator interface. First, you need to find those major resource types. After logging in to the administrator portion of a hub, go to the components list and find “Resources”. From there, you can either choose “Types” from the sub-menu or click “Resources” and choose “Types” from the navigation bar on the page. In either case, you’ll end up at the resource type manager which happens to default to listing the major types.
After selecting a type (clicking on the type’s title), you will be presented with the “Edit type” form. Scrolling to the bottom of the form, you should now find the object of this hunt: the custom field interface.
You can choose the most suitable custom field type (see below) for your purposes. For example, you could choose to create this field as a Single Line Text Field, in which users can type whatever they wish, or as a Select List, which will force users to select from a list of pre-defined options.
- Single-line text (max of 250 characters)
- Multi-line text (textarea)
- Select (drop down list of choices)
- Checkbox (tick one or more for a list of choices)
- Radio (tick only one for a list of choices)
- Hidden (allows you to set a custom field value for specific resource types)
- Pre-defined — These are fields that may have predefined options, such as a list of languages, or bring extra functionality such as geolocation (finds the latitude and longitude of an address)
Most of the resource types found in a default hub install will already have two or three custom fields that are typically multi-line text boxes. If your hub has no contributions as of yet, feel free to change these however you wish. Otherwise, see the cautionary note “Changing an existing field” below.
To add a custom field, simply click the “+ Add new row” button found at the bottom of the custom fields list.
With the new row, you can now add a label, select the type, decide if it is a required field (users must enter/select something), and enter any options desired.
Sometimes, the order of fields has meaning or helps facilitate the process of inputting data. You’re in luck! Custom fields can be rearranged easily by simply dragging and dropping a row. To move a row, click the icon that looks like a stack of pancakes (stacked horizontal bars) and drag up or down to the desired position.
Changing existing fields
The label for a field can be changed at any time without losing existing contributed data. When first creating a custom field, a key is created. It is this key that is associated with the data and, since it is internal and not available for editing, will never change.
A word of caution, however, on changing field types. Some changes may be innocuous, such as going from a single-line text box to a multi-line text box or adding options to a checkbox list, but others can be potentially destructive to existing data. For example, if you do the reverse and go from a multi-line text box to a single-line text box, you can truncate data and end up with partial sentences or even words. Changing to other types such as a select list or checkbox presents other issues as well. If the data already contributed by users doesn’t match any of the select or checkbox options, the result will appear as though no data was entered at all!