I noticed that the 'comment settings' radio buttons ('#type' => 'radios') were not respecting their default value settings in my content types.

I have several module created custom content types, as well as the normal 'Page' and 'Book' content types in this D6 installation, and all of my custom content type's node forms are appearing with apparently random values for their default values.

Repeated loads of the same node form shows different default values for 'comment settings' every time. Looking at the $form arrays for my content types and comparing them against the $form array for a Page content type I only saw one difference: the use of the '#parent' element; I added to my logic (as shown below) but it makes no difference.

I noticed this while trying to create a 'radios' form element for a non-node creation form. Here's some logic I'm using that should give me a consistent default value, but does not:

$form['radios-test'] =     
    array( '#type'          => 'radios',
           '#parents'       => array('radios-test'),
           '#title'         => '',
           '#default_value' => 0,
           '#options'       => array(t('first'), t('second'), t('third')),
           '#description'   => 'explainer text goes here',

What am I missing here?

1 Answer 1


Your code works fine at my end, I always get "first" selected on repeated page refresh. Can you copy paste your actual code that is showing different value for comment settings? Maybe something else is interfering. Can you paste your code at one of the pastebins - http://pastebin.com/ ?

Below is a screenshot at my end.

screenshot of radios form api render

  • There must be some jquery or something interfering, because the above pretty much is my code. I've been investigating, and it looking like there may be some interaction with the D6 Vertical Tabs module, which I just started using... investigating... May 1, 2011 at 9:04
  • Well, I've tried disabling Vertical Tabs and I still have the issue... something, some module I'd added to this installation must be stepping on things... ugh, now's when I wish I had step debugging... May 1, 2011 at 19:26
  • any luck? you can have step debugging in drupal - drupal.stackexchange.com/questions/545/how-do-i-debug-drupal
    – Dipen
    May 3, 2011 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.