我有 Ahah 助手的表格。当我尝试填写表格时,它总是收到此错误:
warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'A' not found or invalid function name in xxx\includes\form.inc on line 378.
A = 函数名称,但该函数存在 xxx = drupal 的位置
第 378 行是:
$form = call_user_func_array(isset($callback) ? $callback : $form_id, $args);
在 page_new_init 处,根本没有错误。但是,在 page_initedit 总是有错误。这是 .module 代码:
$items['new/init/1'] = array(
'title' => 'Add new',
'type' => MENU_LOCAL_TASK, //MENU_NORMAL_ITEM,
'page callback' =>'page_new_init',
'access arguments' => array('new'),
);
$items['new/editinit'] = array(
'title' => 'Edit',
'type' => MENU_CALLBACK, //MENU_NORMAL_ITEM,
'page callback' =>'page_initedit',
'access arguments' => array('new'),
'file' => 'act.edit.inc',
);
这是函数“page_new_init”的形式:
function page_new_init(){
global $user;
$output .= drupal_get_form('form_new_add2',$id,$codeact);
return $output;
}
function form_new_add2(){
global $user;
$form = array();
ahah_helper_register($form, $form_state);
drupal_add_js("sites/all/modules/act/javascript/jss.js");
$form['input']['account'] = array(
'#type' => 'textfield',
'#title' => t('Account Code'),
'#size' => 60,
'#default_value' => $account,
'#required' => TRUE,
'#autocomplete_path' =>'compose/code',
'#ahah' => array(
'event' => 'change',
'path' => ahah_helper_path(array('input')),
'wrapper' => 'input-wrapper',
'method' => 'replace',
'progress' => 'throbber',
),
$form['input']['access_code'] = array(
'#type' => 'select',
'#title' => t('Access Code'),
//'#required' => TRUE,
'#default_value' => $access_code,
'#options' => opt_accesscode(),
);
return $output;
}
这是另一个函数“page_initedit”:
function page_initedit(){
global $user;
$output .= drupal_get_form('form_initedit',$id,$codeact);
return $output;
}
function form_initedit(){
global $user;
$form = array();
ahah_helper_register($form, $form_state);
drupal_add_js("sites/all/modules/act/javascript/jss.js");
$form['input']['account'] = array(
'#type' => 'textfield',
'#title' => t('Account Code'),
'#size' => 60,
'#default_value' => $account,
'#required' => TRUE,
'#autocomplete_path' =>'compose/code',
'#ahah' => array(
'event' => 'change',
'path' => ahah_helper_path(array('input')),
'wrapper' => 'input-wrapper',
'method' => 'replace',
'progress' => 'throbber',
),
$form['input']['access_code'] = array(
'#type' => 'select',
'#title' => t('Access Code'),
//'#required' => TRUE,
'#default_value' => $access_code,
'#options' => opt_accesscode(),
);
return $output;
}
在“page_new_init”上,完全没有错误,Aahah 助手工作正常。但是在“page_initedit”上出现了错误:
warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'form_initedit' not found or invalid function name in drupal\includes\form.inc on line 378.
我该怎么办?