Skip to content

InputfieldWrapper label has empty "for" #1958

@hiboudev

Description

@hiboudev

Short description of the issue

When adding a label to an InputfieldWrapper, the "for=" is empty.
When I hover the form, Firefox shows a warning in console: Empty string passed to getElementById().

I see that wrapper is a <li>, so there's no input to target in label.for, so maybe the wrapper label should be a div?

Expected behavior

Label should target the corresponding wrapper.

Steps to reproduce the issue

$form = new InputfieldForm();

$roundWrapper = (new InputfieldWrapper())
    ->attr('id', "wrapper")
    ->label("wrapper");

$input = (new InputfieldSelect())
    ->attr('id', "input")
    ->label("select");

$form->add($roundWrapper);
$roundWrapper->add($input);
echo $form->render();

HTML of the wrapper label:
<label class='InputfieldHeader ui-widget-header' for=''>

Setup/Environment

  • ProcessWire version: 3.0.240

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions