In Drupal, when you create a select field and you make that field required, you are very likely to run into a weird issue.

The required field will get the first value of the list, making it very easy for the user to overlook it. If the user overlooks it, there is a high probability the first value will not be the correct one. Putting an empty first value does not work as well, as Drupal will just ignore it.

This is actually an easy problem to tackle but the answer might be a little difficult to find. First you should now that you can differentiate the label and the value while configuring the select list. The convention is value|label.

To solve our problem, we are just going to use null value for the first value of the select list. For example |-- Please select --

So a required language list will be something like this. The first value being empty will make Drupal ask for something else if left untouched:

|-- Please select --

PS: You do not have to use labels for other values

Source: grendzy

  1. Thanks very much, this was nearly exactly what I was looking for. Do you have any suggestions for nodereference lists? I know I can probably make a small custom module for those lists, but this first solution was so elegant . . .

  2. Glad to be able to help =). Never tried this for nodeference lists. Interesting though. Will let you know if I have some time to give it a try.

  3. Try http://drupal.org/node/789116#comment-3365604 for nodereference and userreference lists