By mickey86 on
Don't know what happened but when I click on whatever submission buttons $form_state['clicked_button'] always gives the first one.
$subform = array(
'#type' => 'fieldset',
'#title' => t('Navigate'),
'#collapsible' => TRUE,
'#collapsed' => FALSE
);
$subform['first'] = array(
'#type' => 'submit',
'#value' => 'first',
'#name' => 'op',
'#description' => t('jump to the first record'),
);
$subform['previous'] = array(
'#type' => 'submit',
'#value' => 'previous',
'#name' => 'op',
'#description' => t('jump to the previous record'),
);
$subform['next'] = array(
'#type' => 'submit',
'#value' => 'next',
'#name' => 'op',
'#description' => t('jump to the next record'),
);
$subform['last'] = array(
'#type' => 'submit',
'#value' => 'last',
'#name' => 'op',
'#description' => t('jump to the last record'),
);
$subform['select'] = array(
'#type' => 'select',
'#title' => t('select a record'),
'#name' => 'op',
'#default_value' => "$id",
'#options' => array(
'' => ''
),
'#description' => t('select the record to jump to'),
'#required' => FALSE
# '#attributes' => array('onChange' => 'this.form.submit()')
);
$result = _my_db_query('SELECT * FROM `%s`', array($table_name.'_view'));
if ($result) {
$options = $subform['select']['#options'];
while ($option = db_fetch_array($result)) {
$options["{$option['id']}"] = check_plain("{$option['display']}");
}
$subform['select']['#options'] = $options;
}
$subform['jump'] = array(
'#type' => 'submit',
'#value' => 'jump',
'#name' => 'op',
'#description' => t('jump to the selected record')
);
return $subform;
Gives always the submit button 'first'.
No cache problem (all cleared, on browser or on server), no theme related, no browser related.
The worst thing is, that it did work before ! (Don't know before what.)
The only thing changed was the addition of an attribute on a select : 'OnChange' => 'this.form.submit();' ; but removed.
Any idea ?
Comments
Ok, found it !
At last, after hours searching deeply I found what was a little buggy : the 'select' shouldn't have the '#name' => 'op' attribute set. It hid the buttons' '#name'.
thanks for those have begun searching ^^
--
mickey_86