Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to add a checkbox of my own to the performance page in the Drupal administration. I am using hook_form_alter like this:

function nci_assay_depot_form_alter(&$form, &$form_state, $form_id){
        case "system_performance_settings":
            $form["caching"]["nci_assay_depot"] = array(
                "#type" => "checkbox"
                ,"#title" => "Refresh Assay Depot Cache when 'Clear All Caches'"
                ,"#default_value" => 1
                ,"#disabled" => 0
                ,"#description" => null
                ,"#weight" => -2
            ) ;

It will display on the page, but the value will not be saved. Any thoughts?

share|improve this question
up vote 1 down vote accepted
  • to have it "repopulate" after save provide a #default_value key that retrieves it on page load.
  • to actually save it append (add another) custom form submit handler to the form, after the original one gets fired. Something like $form['#submit'][] = 'mymodule_mysubmit_handler'; You will have to check where the submit handler is set already in the form, or the element you're trying to hook into (such as $form['caching'] ...
share|improve this answer
This worked perfectly, thank you! – Nate Starner Jan 28 '13 at 17:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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