drupal7中的drupal_set_message延迟显示的问题
在使用drupal7中的,发现$message的输出会延迟。 例如我在登陆页面故意输出错误的用户名和密码,这时候系统除了输入框变为红色外,并没有出现应该有的如“你的用户名或密码有误”这样的$message提醒。而是只能在再次刷新页面后才出现。
请问怎样才可以即时出现而不用按F5刷新网页后才显示? |
|
zingLv 4
|
赞成!
0
否决!
|
在使用drupal7中的,发现$message的输出会延迟。 例如我在登陆页面故意输出错误的用户名和密码,这时候系统除了输入框变为红色外,并没有出现应该有的如“你的用户名或密码有误”这样的$message提醒。而是只能在再次刷新页面后才出现。
请问怎样才可以即时出现而不用按F5刷新网页后才显示? |
zingLv 4
|
3 个回答
这种drupal_set_message,drupal_get_message 延迟的情况,很有可能是因为你写的顺序有错了。
延迟:
正常:
分头诗人Lv 17
请问这段代码具体在drupal7的什么地方呢?我没能在user模块里找到
zingLv 4
我不知道这段代码应该如何改:
function user_login($form, &$form_state) {
global $user;
// If we are already logged on, go to the user page instead.
if ($user->uid) {
drupal_goto('user/' . $user->uid);
}
// Display login form:
$form['name'] = array('#type' => 'textfield',
'#title' => t('Username'),
'#size' => 60,
'#maxlength' => USERNAME_MAX_LENGTH,
'#required' => TRUE,
);
$form['name']['#description'] = t('Enter your @s username.', array('@s' => variable_get('site_name', 'Drupal')));
$form['pass'] = array('#type' => 'password',
'#title' => t('Password'),
'#description' => t('Enter the password that accompanies your username.'),
'#required' => TRUE,
);
$form['#validate'] = user_login_default_validators();
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Log in'));
return $form;
}
zingLv 4