Using FormAPI to create a simple set of three image_buttons, in the form_submit handler there is no 'op' value set in $form_state and therefore no way to tell which image_button was clicked. Is this a limitation of image_buttons?
Here's what I used to create the form, and it's bare-bones submit handler that shows no information telling me which button was clicked:
function cex_dash_top_icons_block_form( $form_state ) {
$form = array();
global $base_url;
$projects_icon_path = '/'.drupal_get_path('module','cex_dash').'/Projects-icon-med.jpg';
$reporting_icon_path = '/'.drupal_get_path('module','cex_dash').'/Reporting-icon-med.jpg';
$help_icon_path = '/'.drupal_get_path('module','cex_dash').'/Help-icon-med.jpg';
$form['projects'] = array(
'#type' => 'image_button',
'#value' => 'Projects Dash',
'#src' => $projects_icon_path,
);
$form['reports'] = array(
'#type' => 'image_button',
'#value' => 'Analytics Dash',
'#src' => $reporting_icon_path
);
$form['help'] = array(
'#type' => 'image_button',
'#value' => 'Documentation Dash',
'#src' => $help_icon_path
);
return $form;
}
function cex_dash_top_icons_block_form_submit($form_id, &$form_state) {
_devReport( 'cex_dash_top_icons_block_form_submit: form_state is "'.print_r($form_state,1).'"' );
}
And no matter which button is clicked, $form_state['values'] looks like this:
[values] => Array( [projects] => Projects Dash [reports] => Analytics Dash [help] => Documentation Dash [form_build_id] => form-b6c762d22d0fd2360d1804ef19043c7d [form_token] => 4f0ce5275cc923e8fb27c305b57bf414 [form_id] => cex_dash_top_icons_block_form )
Now, in the larger $form_state
array there is a 'clicked_button' array, but that always only has the information for the last image_button.
Do I need to create one mini-form for each image_button?