[Web:S6853] "A form label must be associated with a control."

<ul class="ProviderType Checkboxing">
	<li th:each="type : ${ webData.enumsMap.get('Provider.Type') }">
		<input type="checkbox" th:id="${'chk_'+type}" name="providerType" th:value="${type}"/>
		<label th:for="${'chk_'+type}" th:text="${ #messages.msgOrNull('enum.Provider.Type.' + type) }"></label>
	</li>
</ul>

Although wrapping input with label can be a solution, having a label side by side with input control at th same level and adding for attribute to label is also a legal construct.

Rule number is printed with extremely small font, so I’m bringing here a screenshot.
Is there a chance to add a button “Copy rule ID” or make it a clickable and do a copy to clipboard in on-click even or something else to avoid typing it letter by letter?

rule

Well, now it’s getting weird for me.
The input element is now wrapped with label and I’m still getting a warning.
I see it’s about “form label” and I don’t even know what that means.
When I open rule description, there are not enough examples to see what I’m doing wrong.

<label th:for="${'chk_'+type}" th:text="${ #messages.msgOrNull('enum.Provider.Type.' + type) }">
	<input type="checkbox" th:id="${'chk_'+type}" name="providerType" th:value="${type}"/>
</label>

1 Like

Hi,

To make sure you’re experiencing this in the latest implementation of the rule, can you share your SonarLint version and/or if you’re in connected mode whether it’s to SonarCloud or SonarQube (and the SQ version)?

 
Thx,
Ann