我想在其它的页面使用user_profile_form这个form
我自己建了一个module,并创建menu:
$items['user/selectrole/individual'] = array(
'title' => 'Select Account Type',
'description' => 'Select Account Type',
'page callback' => 'arkitheme_user_select_role_individual',
'access callback' => 'user_access',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK
);
然后页面回调函数:
function arkitheme_user_select_role_individual()
{
global $user;
$form_id = 'user_profile_form';
$form_state = array();
$form_state['build_info']['args'] = array($user);
// Load user.pages.inc and ensure it is automatically reloaded if
// this form is rebuilt via AJAX or other means.
form_load_include($form_state, 'inc', 'user', 'user.pages');
return drupal_build_form($form_id, $form_state);
}
表单页面可以显示,但是碰到三个问题:
1、表单里所有字段值都为空,没有默认显示已经填写的值。
2、form的action是menu中定义的action,并不是user/%/edit
3、表单提交后,我希望跳转到一个我希望的URL,我的代码:修改form的action:
$form['#action'] = '/user/1/edit?destination=/user/selectrole/getstarted'
但是不管用。
求助,上述问题如何解决?谢谢
Drupal 版本
我发现我的问题所在的,把提交表单的HTML
我发现我的问题所在的,把提交表单的HTML
由 <input type="submit" ...
错写为 <button .... 了
第二三个问题已解决,就差第一个默认值的问题。有可能是传入值有问题,继续研究
http://drupal.stackexchange