Ich bin wirklich hier ratlos. Ich habe eine Ajax-Form mit einer Schaltfläche - tatsächlich hat die eine darunter eine Schaltfläche und ein Auswahlobjekt, die beide die gleiche Callback-Funktion aufrufen.Drupal7 Forms API: Ajax-Taste nicht feuern Callback
Was ich will: die Schaltfläche, um den Rückruf aufzurufen, aber nicht das Formular abschicken.
Was ich habe: die Auswahl ruft den Rückruf in Ordnung, aber die Senden-Taste tut nichts .
Gedanken?
function my_module_pane_checkout_form($form, $form_state, $checkout_pane, $order) {
$pane_form = array();
$pane_form['codes'] = array(
'#prefix' => '<div id="codes-fieldset-wrapper">',
'#suffix' => '</div>',
);
$pane_form['codes']['add_code_0'] = array(
'#type' => 'radios',
'#options' => array(1 => 'One', 2 => 'Two'),
'#ajax' => array(
'callback' => 'my_module_pane_callback',
'wrapper' => 'codes-fieldset-wrapper',
),
'#default_value' => 1,
);
$pane_form['codes']['add_code'] = array(
'#type' => 'submit',
'#value' => 'Add Code',
'#ajax' => array(
'callback' => 'my_module_pane_callback',
'wrapper' => 'codes-fieldset-wrapper',
),
);
return $pane_form;
}
function my_module_pane_callback($form, $form_state) {
watchdog('php', 'inside callback');
return $form['my_module'];
}
Zu beachten: Dieses Formular sitzt auf einem Commerce-Checkout-Bereich (ah, die Freude). –