By nancydru on
I have a module that potentially interacts with the new comment form. I see the expected values for an anonymous user coming into hook_form_alter and my modified values going out. However, when the form displays the name and email addresses are populated with some values that AFAICT are not in the database (yes they were one upon a time).
This is from hook_form_alter:
global $user;
switch ($form_id) {
case 'comment_form':
if(!isset($user->realname)) {
$user = user_load(array('uid' => $user->uid));
}
if ($user->uid) {
$form['name']['#default_value'] = $user->realname_save;
}
else {
$form['name']['#default_value'] = variable_get('anonymous', 'Anonymous');
$form['mail']['#default_value'] = t('Enter your email address here.');
}
break;
This is happening for anonymous users, so the "else" clause is working, and a print_r show the modified form being returned. But those values are not being displayed.
Comments
Further info
This old data overrides any entered values on the first submit (I use preview required). However, if I re-enter the correct values on the preview screen, they get taken.
I do not see this behavior in IE7 - only in FF3.
NancyDru