By jessehouchins on
I know this has probably been asked before, but I'm loosing my mind and I don't have any patience left to find it (although I have tried).
I am trying to create a config page for the module I'm developing. I (finally) got the config page to display correctly, but when I change a setting, the page always reloads with the default values, not the settings I just tried to save. This is my first module, so I'm probably doing something stupid and don't realize it.
I read somewhere that uninstalling and reinstalling my module might help... it didn't. Please help.
Here is my code:
function weathereye_settings() {
$form = array();
// Current weather observations settings
$form['weathereye_observations'] = array(
'#type' => 'fieldset',
'#title' => t('Current weather observation settings'),
'#tree' => TRUE,
);
$form['weathereye_observations']['weathereye_observations_source'] = array(
'#type' => 'textfield',
'#title' => t('Source (XML)'),
'#default_value' => variable_get('weathereye_observation_source', ''),
'#description' => t('A URL to the National Weather Service XML feed (not RSS) for the location of your choice.'),
);
$period = array('0' => 'Most recent only');
$period = array_merge($period, drupal_map_assoc(array(86400, 172800, 259200, 345600, 432000, 518400, 604800), 'format_interval'));
$form['weathereye_observations']['weathereye_observation_expiration'] = array(
'#type' => 'select',
'#title' => t('Keep weather observations for'),
'#default_value' => variable_get('weathereye_observation_expiration', 604800),
'#options' => $period,
);
// Weather forecast settings
$form['weathereye_forecasts'] = array(
'#type' => 'fieldset',
'#title' => t('Weather forecats settings'),
'#tree' => TRUE,
);
$form['weathereye_forecasts']['weathereye_forecasts_zip'] = array(
'#type' => 'textfield',
'#title' => t('Zip code fore forecasts'),
'#default_value' => variable_get('weathereye_forecasts_zip', ''),
'#description' => t('The zip code for your location.'),
);
return system_settings_form($form);
}
Comments
I don't know the answer, but
I don't know the answer, but am curious. What happens if you try the following: