I have a very weird problem, my custom forms submition doesn't work unless devel module is active. any ideas how to solve this problem?
function forexCompare_form_submit($form,&$form_state){
$array = unserialize(variable_get('forexCompare_company1',""));
$array[] = t($_POST['forexCompare_company1']);
variable_set('forexCompare_company1',serialize($array));
//drupal_set_message(print_r($form_state)." k".$_POST['forexCompare_company1']);
}
function forexCompare_form($form,&$form_state){
return array(
'forexCompare_company1' => array(
'#type' => 'select',
'#title' => 'Company #1',
'#options' => getCompanies()
),
'forexCompare_company2' => array(
'#type' => 'select',
'#title' => 'Company #2',
'#options' => get_stored_comp()
),
'submit' => array(
'#type' => 'submit',
'#value' => 'Save',
),
'#submit' => array(
'forexCompare_form_submit'
)
);
}
i have notice that when i return the drupal_get_form() on the page callback , but when i pass it as variable in theme function doesnt work
function userOptions_theme(){
global $user;
$user_loaded = user_load($user->uid);
return array(
'settings_user_transfer'=>array(
'template' => 'setting',
'variables' => array('money' => $user_loaded,'form' => drupal_get_form('userOptions_form'))
)
);
}
$form_state['values']
when processing submitted values in a submit handler.drupal_render($form)
; you just return the output of drupal_get_form() in a menu callback. See form_example.module for an example.