Some modules such as Name add more than one <label> element per form field. For example, if you set the name field label to show up "below" the field, it sets the normal label element to be visually hidden, and then adds an additional one beneath the field. The javascript for this module selects both labels and concatenates them to form the float label, resulting in the bug in the attached image.

One solution to get around this is to make sure the name field label is set to appear "above" the field - then it will only have one label element. To get around having to specify this in the module instructions, we can edit the JS to always select the first label returned by the var $label = $(element).closest('form').find('label[for=' + id + ']') selector.

Patch will follow shortly...

Comments

amklose created an issue. See original summary.

amklose’s picture

Patch...

amklose’s picture

Status: Active » Needs review
amklose’s picture

Issue summary: View changes
jbernthal’s picture

StatusFileSize
new512 bytes

I updated the patch - for some reason, the previous patch was working on one site, but on another, the $label variable was not being seen as a valid jQuery element, so the $label.length check failed, as well as the $label.text() call. To fix this, I wrapped the code used to select the corresponding label in a jQuery element wrapper to make sure it's the right type of object. I also removed the " > 0" in the $label length check as it's unnecessary.

amklose’s picture

Blagh - sorry - that last comment/patch was from me. I was logged in under the wrong account.

  • bmcclure committed 710249d on 8.x-1.x authored by amklose
    Issue #3120166 by amklose: Some field labels are being duplicated in the...
replicaobscura’s picture

Status: Needs review » Fixed

Thanks Tony!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.