Hi Y'All,

I'm doing something stupid, and cant for the life of me figure it out.

I've got a confirguration page for admin and have built a form. I'm using variable_get() to either get the variable or it's default value. Trouble being I can change the settings in the form and save, and the default values are re-instated!

Example field

  $form['carousel_ui_settings']['carousel_ui_index'] = array(
    '#type' => 'checkbox',
    '#title' => t('Numerical Index list'),
    '#default_value' => variable_get('carousel_ui_index', 'checked'),
    '#size' => 5,
    '#maxlength' => 5,
    '#description' => t("Display a clickable, numercial list of items for navigation."),
    '#required' => TRUE,
  );

It this example, the checkbox, if unticked and saved, gets ticked again after the form is submitted. this happens with all my fields.

Any help would be greatfully accepted, and if more code is needed then I'll whack it up.

Cheers

S

Comments

frankiedesign’s picture

I copied your code into the settings function of one of my modules, and it saves the value as expected.
Could you post your code, let's say, starting from the hook_menu point?

Zyava’s picture

Your variables (which you want to store in db) must have your module name as prefix.