I have come across this issue a number of times where I call the various functions but I get no output. Please refer to the code beneath:

variable_set('data', array('N/A', 'FirstName', 'LastName', 'AddressLine#1', 'AddressLine#2', 'AddressLine#3', 'Town/City', 'PostCode', 'Country', 'Email'));

function mymodule_form_alter(&$form, &$form_state, $form_id){

	$form['my_form']['container'] = array(
		'#type' => 'fieldset',
		'#title' => t('Data fieldset'),
		'#collapsible' => TRUE,
		'#collapsed' => TRUE,
		'#weight' => 50,
	);
	$form['my_form']['container']['field_options'] = array(
		'#type' => 'select',
		'#title' => t('Data field options'),
		'#options' => variable_get('data'),
		'#description' => t('<em>Select the type of data</em>'),
	);

  $form['#submit'][] = '_data_settings';

}

function _data_settings(&$form, &$form_state){
  // print("<pre>");
  // print_r($form_state);
  // print("</pre>");
  // die();
  drupal_set_message("TESTING TESTING!");

  dsm($form_state);
}

As you can see I am calling the dsm function with an argument of $form_state. I get no response.
The drupal_set_message function call DOES respond.
If I use the print_r code above it, I see the form output but dsm, dvm and dpr don't respond.

Can you help with this?

Comments

salvis’s picture

Priority: Critical » Normal

Have you updated to the -dev version yet?

Have you tried dpm("TESTING TESTING!"); ?

yash_khandelwal’s picture

Issue summary: View changes

Hi,

While using dsm()/ dpm() or dvm(), first you should install and enable devel module on your drupal project.
Also just add submit button in form. Then submit handler ($form['#submit'][]) works.

Below code worked for me. Try it.

/**
  * Implements hook_menu().
  */

function issues_menu() {
    $items['my/demo_form'] = array(
      'page callback' => 'drupal_get_form',
      'page arguments' => array('my_demo_form'),
      'access callback' => TRUE,
      'type' => MENU_CALLBACK,
    );
    return $items;
}

function my_demo_form($form, &$form_state) {
   variable_set('data', array('N/A', 'FirstName', 'LastName', 'AddressLine#1', 'AddressLine#2', 'AddressLine#3', 'Town/City', 'PostCode', 'Country', 'Email'));
    $form['my_form']['container'] = array(
		'#type' => 'fieldset',
		'#title' => t('Data fieldset'),
		'#collapsible' => TRUE,
		'#collapsed' => TRUE,
		'#weight' => 50,
	);
	$form['my_form']['container']['field_options'] = array(
		'#type' => 'select',
		'#title' => t('Data field options'),
		'#options' => variable_get('info'),
		'#description' => t('Select the type of data'),
	);
  $form['save']= array(
    '#type' => 'submit',
    '#value' => 'submit',
  );
    return $form;
}
/*
 * Implementation of hook_form_alter()
 */

function issues_form_alter(&$form, &$form_state, $form_id) {
  variable_set('info', array('ID', 'FirstName', 'LastName', 'AddressLine#1', 'AddressLine#2', 'AddressLine#3', 'Town/City', 'PostCode', 'Country', 'Email'));
    $form['my_form']['container'] = array(
		'#type' => 'fieldset',
		'#title' => t('Data fieldset'),
		'#collapsible' => TRUE,
		'#collapsed' => TRUE,
		'#weight' => 50,
	);
	$form['my_form']['container']['field_options'] = array(
		'#type' => 'select',
		'#title' => t('Data field options'),
		'#options' => variable_get('info'),
		'#description' => t('Select the type of data'),
	);

  $form['#submit'][] = '_data_settings';
}

function _data_settings(&$form, &$form_state){
  drupal_set_message("TESTING TESTING!");
  dsm($form_state);
}
yash_khandelwal’s picture

Status: Active » Closed (fixed)
yash_khandelwal’s picture

yash_khandelwal’s picture

Assigned: Unassigned » yash_khandelwal
yash_khandelwal’s picture

salvis’s picture

Assigned: yash_khandelwal » Unassigned

Would you like to work on this? Then please open it and let us know your intentions.