【发布时间】:2011-11-08 17:26:17
【问题描述】:
我在尝试以编程方式显示要在我的节点页面视图区域中显示的表单时遇到了困难。我的“简单模块”中有以下代码。
function simplemodule_newcomer_form($form_state){
$form = array();
$form['simplemodule_newcomer']['name'] = array(
'#type' => 'textfield',
'#title' => t('name'),
'#description' => t(''),
'#weight' => -1,
);
$form['simplemodule_newcomer']['email'] = array(
'#title' => t('email'),
'#type' => 'textfield',
'#description' => t(''),
'#weight' => 0,
);
$form['simplemodule_newcomer']['phone'] = array(
'#title' => t('telephone No.'),
'#type' => 'textfield',
'#description' => t(''),
'#weight' => 0,
);
$form['submit_button'] = array(
'#type' => 'submit',
'#value' => 'enter',
);
return $form;
}
function simplemodule_newcomer_form_submit($form_id, &$form_state){
//dealing with submitted data
}
此代码有效,但仅来自我的管理菜单中定义的链接。
我想要做的是让表单以视图模式在特定节点上显示和提交。这样就产生了访问节点时有表单要填写的效果。
【问题讨论】:
标签: php forms drupal drupal-6 drupal-modules