我想从表单上的另一个ajax事件调用一个工作的ajax事件,这里是表单的代码
function ajax_forms_multicallback($form,&$form_state){
$form = array();
$form['test1'] = array(
'#prefix' => '<div id="prefix">',
'#suffix' => '</div>'
);
$form['field1'] = array(
'#type' => 'textfield',
'#title' => t('Field'),
'#ajax' => array(
'callback' => 'ajax_forms_muticallback_1',
),
);
$form['submit1'] = array(
'#type' => 'submit',
'#value' => 'Submit',
'#ajax' => array(
'callback' => 'ajax_forms_multicallback_submit_callback',
'wrapper' => 'prefix',
),
);
return $form;
}
这是我的第一个ajax回调函数,它调用另一个回调函数
function ajax_forms_multicallback_1($form,$form_state){
$commands = array();
$commands[] = ajax_command_invoke('#edit-submit','click') //calling the click event on the submit button so it will call the ajax_forms_multicallback_submit_callback ;
return array('#type' => 'ajax','#commands' => $commands);
}
这是我的第二个ajax回调函数
function ajax_forms_multicallback_submit_callback($form,$form_state){
return "Hello";
}
目前它没有调用第二个函数。我可以解决这个问题吗