Secondary submit function for form input button I want to have buttons for remove selected field from form.

    $form['questions']['buttons'][$counter] = array(
        '#type' =&gt; 'button', 
        '#name' =&gt;'button_'.$counter, 
        '#value' =&gt; t('Remove'),
        '#submit' =&gt; array('my_mod_remove_submit'),
    );


Submit function:

function my_mod_remove_submit($form, &amp;$form_state) {
    drupal_set_message('&lt;pre&gt;'.print_r($form_state, 1).'&lt;/pre&gt;');
}


But it seems that this function is never invoke.
The problem with your code is the default value for the form field attributes. In the case of the "button" form field, these are the default values:


#name => 'op'
#button_type => 'submit'
#executes_submit_callback => FALSE
#ahah['event'] => 'mousedown'


Those are also the default values for Drupal 7.

If you want to use a submission callback for a button, then you need to change the form field definition to the following one:

$form['questions']['buttons'][$counter] = array(
  '#type' =&gt; 'button', 
  '#name' =&gt;'button_' . $counter, 
  '#value' =&gt; t('Remove'),
  '#executes_submit_callback' =&gt; TRUE,
  '#submit' =&gt; array('my_mod_remove_submit'),
);


As alternative, instead of using a "button" form field, you should use a "submit" form field.