Using the Options Element

Not all contributed modules are about making life better for just our website users. Some exist to improve the lives of website administrators too. As we saw in Chapter 2, Trying Out Webform, the standard method is to type our selection list options into a textarea with an internal key and screen text value, separated by a vertical pipe symbol. The Options Element module provides Webform with a neat user interface for setting up the select options we wish to use on our forms.

Getting ready

Let us go to the project home page to download, install, and enable the module: http://drupal.org/project/options_element.

How to do it...

Returning to our Title component edit page, we find that the somewhat dreary plaintext area where we entered our select options previously has been replaced by a handy tabular interface that operates a little more intuitively for many administrators.

How to do it...

How it works...

We can now easily change the sequence of our options by clicking on and dragging the handles to the left of each option row. Setting a default selection is achieved by checking the Default radio button on the pertinent row. An option may be deleted by clicking on the red cross and a new option can be inserted below the current option by clicking on the green plus sign.

Should we wish to return to the standard way of doing things all we need do is click on the Manual entry link below the OPTIONS table.

There's more...

Let's take a look at how the Options element operates under the hood.

Custom option keys

By default, the internal option key used by Webform will be a numeric value, counting from zero upward. In our case here, the option keys are the same as we originally entered.

For those occasions where we would rather specify a different key value we can check the Customize keys (Advanced) option. Each option row in the table now expands to include space where we may specify the option keys ourselves.

Custom option keys
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset