Associating a <label> with a form control

Signed-off-by: Antoine Rey <antoine.rey@free.fr>
This commit is contained in:
Antoine Rey 2025-02-26 22:38:26 +01:00 committed by Dave Syer
parent 7f1af268ec
commit fceca7754a
2 changed files with 2 additions and 2 deletions

View file

@ -5,7 +5,7 @@
<div th:with="valid=${!#fields.hasErrors(name)}"
th:class="${'form-group' + (valid ? '' : ' has-error')}"
class="form-group">
<label class="col-sm-2 control-label" th:text="${label}">Label</label>
<label th:for="${name}" class="col-sm-2 control-label" th:text="${label}">Label</label>
<div class="col-sm-10">
<div th:switch="${type}">
<input th:case="'text'" class="form-control" type="text" th:field="*{__${name}__}" />

View file

@ -5,7 +5,7 @@
<div th:with="valid=${!#fields.hasErrors(name)}"
th:class="${'form-group' + (valid ? '' : ' has-error')}"
class="form-group">
<label class="col-sm-2 control-label" th:text="${label}">Label</label>
<label th:for="${name}" class="col-sm-2 control-label" th:text="${label}">Label</label>
<div class="col-sm-10">
<select th:field="*{__${name}__}">