I have a form like this:
$form['my_button'] = array(
'#type' => 'button',
'#ajax' => array(
'callback' => 'my_callback_1',
'wrapper' => 'some_wrapper',
)
);
Which works fine (code is very simplified). Now, in the callback, I want to return another button, which also has ajax configured:
function my_callback_1() {
return array(
'my_other_button' => array(
'#type' => 'button',
'#ajax' => array(
'callback' => 'my_callback_2',
'wrapper' => 'some_other_wrapper',
)
),
);
}
function my_callback_2() {
return array('#markup' => 'success!!');
}
Now, when I click on the first button, Drupal loads the second button just fine. The problem is, a click on the second button does nothing. Am I missing something?