Making a radios form element required How can I make which_option required so that users are forced to select an option?

$options = array(
  'Design1' =&gt; t('Design 1'),
  'Design2' =&gt; t('Design 2'),           
);

$form['which_option'] = array(
  '#name' =&gt; 'which_option',        
  '#id' =&gt; 'which_option',
  '#type' =&gt; 'radios',           
  '#required' =&gt; TRUE,
  '#options' =&gt; $options,
  '#default_value' =&gt; isset($which_option) ? $which_option : NULL,
  '#prefix' =&gt; '&lt;br&gt;&lt;hr&gt;&lt;br&gt;&lt;p&gt;If you&amp;apos;re a lucky winner, tell us which bag you would like&lt;/p&gt;&lt;br&gt;&lt;div class="label-wrap"&gt;',
  '#suffix' =&gt; '&lt;/div&gt;',
);
Looking at the code used from Drupal core, I found that book.admin.inc uses the following code, to define a require radios element.

$types = node_type_get_names();

$form['book_child_type'] = array(
  '#type' =&gt; 'radios',
  '#title' =&gt; t('Content type for child pages'),
  '#default_value' =&gt; variable_get('book_child_type', 'book'),
  '#options' =&gt; $types,
  '#required' =&gt; TRUE,
);


The code you shown doesn't work because #default_value is set to NULL.

'#default_value' =&gt; isset($which_option) ? $which_option : NULL,


You don't show how $which_option is initialized; either that variable is never initialized, or it is not initialized when you tested the code. In both the cases, isset($which_option) returns FALSE and #default_value is set to NULL.

Instead of that, the code should avoid setting #default_value, which is what form_test.module (a module for testing form elements) does. (See the first form element in the following code; the other form elements are shown to make a comparison.)

$form['radios'] = array(
  '#type' =&gt; 'radios',
  '#title' =&gt; 'Radios',
  '#options' =&gt; $options,
  '#required' =&gt; TRUE,
);
$form['radios_optional'] = array(
  '#type' =&gt; 'radios',
  '#title' =&gt; 'Radios (optional)',
  '#options' =&gt; $options,
);
$form['radios_optional_default_value_false'] = array(
  '#type' =&gt; 'radios',
  '#title' =&gt; 'Radios (optional, with a default value of FALSE)',
  '#options' =&gt; $options,
  '#default_value' =&gt; FALSE,
);


Notice the first radios element, which is required, doesn't have any #default_value property set.