Drupal FAPI reference doesn't have a working example for #type=>radio. How can I indicate that I want the element to be rendered in a checked state?

$form['my_radio_button'] = array(
  '#type' => 'radio',
  '#default_value' => TRUE,
  '#title' => t('Checked by default.'),

I've tried #default_value TRUE, 1, and different combinations of #value, but nothing seems to work. Thanks!

  • 2
    I think that's in there so you can format the actual radio button that's presented within a set of radio buttons. A singular one wouldn't make much logical sense; what I think you are after is a checkbox...
    – Jimajamma
    Mar 18, 2014 at 17:48

1 Answer 1


I may be totally remembering this wrong, but I'm pretty sure you want to add "checked" as an attribute.

attributes => array("checked")

  • Add the 'checked' attribute (with a value) worked for me, thanks!
    – joshf
    Mar 18, 2014 at 17:52

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.