Submit field openid disappears
bramk - October 14, 2008 - 10:10
| Project: | OpenID |
| Version: | 5.x-1.x-dev |
| Component: | OpenID Client |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | needs work |
Description
Hi,
I'm trying to install the openid module voor drupal (5.11) and everything seems fine. But as soon as I click the 'Login using OpenID' link the normal username and password disapear and there's not comming another textfield back! How im I supposed to fill in the openid link? Maybe some settings are wrong but i'm kinda lost.. So thx,
Bram.

#1
I have the same problem.
I've been using OpenID on my site for some time, and it worked fine before upgrading core to 5.11. (I use the latest stable version of OpenID, 5.x-1.2)
I've tried changing to Garland on the off chance that it's theme related, but the same thing happens there.
#2
I can confirm. The recent upgrade to 5.11 seems to have broken the OpenID URL field on the login form.
#3
I have the same problem.
On my test web site I was able to fix it by editing the "openid.module" file. I have comment out lines: 106 and 107.
$form['openid_identifier'] = array('#type' => 'textfield',
'#title' => t('Log in using OpenID'),
'#size' => ($form_id == 'user_login') ? 58 : 13,
'#maxlength' => 255,
'#weight' => -1,
'#description' => l(t('What is OpenID?'), 'http://openid.net/'),
// '#prefix' => '<div id="edit-openid-identifier-wrapper">',
// '#suffix' => '</div>'
);
It works, but I don't know what is the full impact. Could someone with more experience in Drupal to confirm that my change didn't create other problems.
#4
This patch solved the problem for me.
Using firebug, I noticed two nested divs with id = "edit-openid-identifier-wrapper". CSS doesn't allow two elements on the same page with the same id. So I commented out the #prefix and #suffix lines in the form array where this markup is inserted.
Now, there is only one div with id = "edit-openid-identifier-wrapper" and the field is showing up again.
Please test this patch and confirm that it works for you.
Best,
sicjoy
#5
Ah, trochevs!
You beat me to the punch by 17 mins.
Great minds think alike, huh?
Cheers,
sicjoy
#6
Hi sicjoy,
I just give up an went to bed. See I am not sure that is the right way for fixing our problem. Here is my observations so far.
1. The problem was created by upgrading the Drupal to 5.11. At the same time it is security fix plus some bug fixes. I started looking what are the differences between 5.10 and 5.11. One of the changes that I found could be the root-cause of current regression. It is in file "drupal\includes\form.inc" On line 1540 the function "theme_form_element" has been changed.
function theme_form_element($element, $value) {$output = '<div class="form-item"';
if (!empty($element['#id'])) {
$output .= ' id="'. $element['#id'] .'-wrapper"';
}
$output .= ">\n";
........
I don't know why. Is it security driven change?
2. Now lets go back to OpenID module. If I disable JavaScript the field is visible an it is working. I re-enable the JavaScript and the field disappears again. Then I go to "firebug" and examined the generated HTML.
<div><div id="edit-openid-identifier-wrapper">
<div class="form-item" id="edit-openid-identifier-wrapper">
<label for="edit-openid-identifier">Log in using OpenID: </label>
<input maxlength="255" name="openid_identifier" id="edit-openid-identifier" size="58" value="" class="form-text" type="text">
<div class="description"><a href="http://openid.net/">What is OpenID?</a></div>
</div>
</div>
<div id="edit-name-wrapper">
<div class="form-item" id="edit-name-wrapper">
<label for="edit-name">Username: <span class="form-required" title="This field is required.">*</span></label>
<input maxlength="60" name="name" id="edit-name" size="60" value="" tabindex="1" class="form-text required" type="text">
<div class="description">Enter your SAL-e.net username.</div>
</div>
</div>
<div id="edit-pass-wrapper">
<div class="form-item" id="edit-pass-wrapper">
<label for="edit-pass">Password: <span class="form-required" title="This field is required.">*</span></label>
<input name="pass" id="edit-pass" size="60" tabindex="2" class="form-text required" type="password">
<div class="description">Enter the password that accompanies your username.</div>
</div>
</div>
<input name="form_id" id="edit-user-login" value="user_login" type="hidden">
<a href="/%2523" class="openid-link">Log in using OpenID</a>
<a href="/%2523" class="user-link">Cancel OpenID login</a>
<input name="openid.return_to" id="edit-openid.return-to" value="http://www.sal-e.net/openid/authenticate?destination=user" type="hidden">
<input name="op" id="edit-submit" value="Log in" tabindex="3" class="form-submit" type="submit">
</div>
As far I can tell there is no difference in the structure between "edit-name", "edit-pass" and "edit-openid-identifier" fields. They all are wrapped twice in
<div id="xxx-wrapper"><div class="form-item" id="xxx-wrapper">....,but yet they behave differently. The only difference I have observed is that the second
<div>...</div><div class="form-item" id="edit-openid-identifier-wrapper">is disabled compare to "edit-name-wrapper".All that makes me believe that problem is in some ware in initial JavaScripts that hides the OpenID field during the first lunch of the page, but so far I have not found it.
The current patch works because we are removing the first
<div>...</div>wrapper and the JavaScripts found in "openid.js" enables and disables the<div class="form-item" id="edit-openid-identifier-wrapper">...</div>. So our patch works in this case, but makes OpenID form inconsistent with the rest of User Login form. All that makes me feel uneasy. Is there anyone that know more about how the forms in Drupal should work?Thank you
#7
Hi Everyone,
I think I found solution without changing the structure of generated login form. I modified the "openid.css" file.
I added to lines that enable the nested
<div class="form-item" id="edit-openid-identifier-wrapper">.html.js #user-login-form div#edit-openid-identifier-wrapper div#edit-openid-identifier-wrapper,html.js #user-login div#edit-openid-identifier-wrapper div#edit-openid-identifier-wrapper {
display: block;
}
Now I don't know enough to determent witch patch is better. I prefer to change the "openid.css", but sicjoy is making an excellent point that having to divs with same ID is confusing. Here we have two patches and the community need to decide witch one to commit.
Good luck everyone.
#8
I ran the w3c validator against my login page. It reports the following errors:
#9
Hi Everyone,
I have to agree with sicjoy. After some time to think about it I would say that both patches found here are only temporary workaround. They need to be applied only until the Drupal core is fix to produce more clean and standard complied html code. I will check to see if there is already open bug report and if I don't find any I will report it there. I just upgraded to Drupal 5.12 and the code generated is the same.
Thank you,
SAL-e
#10
I would like to confirm that this patch of the CSS worked, but the other patch of the "div id" didn't do anything for me.
I can now apply this patch as well as http://drupal.org/node/233885 to get things working. It may not be the best solution, but it is worth committing and releasing to get things working in the interim while a potential better solution is discussed.
#11
The patch in #4 applies cleanly and fixes the problem for me.
I think that having the repeating ids is quite bad. Just because Drupal core generates markup for the login form that is wrong doesn't mean that the openid module should do it too.
trochevs, did you ever open a bug report about the markup problem for core? Would you mind linking to it here?
Thanks,
Colin
#12
I'm really eager to see this; I just started setting up OpenID around the time that 5.11 became available, so I've been totally confused by this problem.
If there's a preferred patch either to OpenID or core, I'd be wiling to try it; I have my sites under version control with Mercurial so it should be trivial to roll back if necessary. It might even give me a reason to try MQ.
#13
Fwiw, I tried patching openid.css only, using "openid_2008-10-18_1.patch" above, and I get the same results as before the patch: missing field for OpenID logins.
I'm using Drupal 5.12 + OpenID 5.x-1.2.
#14
The patch in #4 applies cleanly and fixes the problem for me. Duplicate ids are a bug. Note that simply commenting out the markup is a workaround - the lines should probably be deleted outright.
Also, check you aren't running the core fix for duplicate ids. I found that it added a '-1' to the user login form '#user-login-1'. This stopped the CSS from hiding the OpenID login form by default.
#15
Same problem here. Using D [edit:5.14] + jquery update.
There shouldn't be the same id twice in the DOM.
This patch follows the approach from #4 but removes the prefix/suffix lines altogether.
I think this is ready to be committed.
#16
The solution #15 worked fine for me, but the fields are giving a "blink" before disappearing with the fadeOut effect. I think the best thing to do is simply to abolish the fadeOut/fadeIn to show/hide the fields, swapping in the openid.js:
$("#edit-pass-wrapper").hide();$("#edit-name-wrapper").fadeOut('medium', function() {
$("#edit-openid-identifier-wrapper").fadeIn('medium');
});
to:
$("#edit-name-wrapper, #edit-pass-wrapper").hide();$("#edit-openid-identifier-wrapper").show();
(sorry, I can't make a patch here).
#17
Here we go
#18
#17: This is in /addition/ to patch in #15, correct?
#19
#18 Yes.
#20
The combination of #15 and #17 work.