我有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;
}
On" page_new_init",根本没有错误,Ahah帮助工作正常。但是在" 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.
我该怎么办?
答案 0 :(得分:0)
在.module文件中,我必须加载.inc文件。这就是我忘记的! :(
include_once(drupal_get_path('module', 'act') .'/act.edit.inc');