Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello!
I use Better Exposed Filters 7.x-3.0-beta4 for exposed sort criteria.
I receive the following validation error: " Line 298, Column 31: The for attribute of the label element must refer to a form control."
Here is the html:
<div class="views-exposed-widget views-widget-sort-by">
<div class="bef-sortby bef-select-as-radios">
<div class="form-item form-type-radios form-item-sort-by">
<label for="edit-sort-by">Sort by </label>
<div class="form-radios" id="edit-sort-by">
<div class="form-item form-type-radio form-item-sort-by">
<input type="radio" class="form-radio" value="sell_price" name="sort_by" id="edit-sort-by-sell-price">
<label for="edit-sort-by-sell-price" class="option">Price </label>
</div>
<div class="form-item form-type-radio form-item-sort-by">
<input type="radio" class="form-radio" value="created" name="sort_by" id="edit-sort-by-created">
<label for="edit-sort-by-created" class="option">Post date </label>
</div>
</div>
</div>
</div>
</div>
I also tried to change the "Display exposed sort options as Radio buttons" to "Display exposed sort options as links". The same validation error.
The patch better_exposed_filters-w3c-validation-1241192-10.patch
did not resolve the issue. It works for exposed filters, not for exposed sort criteria.
Can you help me with the problem?
Kind regards,
Tchka
Comments
Comment #1
tisteegz CreditAttribution: tisteegz commentedI am also having the same issue. Has anyone found a fix for this?
Comment #2
mikeker CreditAttribution: mikeker as a volunteer commentedI'm not able to reproduce this with the latest BEF. Yes, it does generate a
<label>
tag with afor
attribute that points to a<div>
instead of a form element. But as far as I can tell, that's valid. At least my page passes the W3C validator. Can you point me at a public-facing example that is not working? Also, are you validating as "XHTML + RDFa"?Comment #3
mikeker CreditAttribution: mikeker as a volunteer commented