Skip to content

Commit c1c5731

Browse files
areydsyer
authored andcommitted
Associating a <label> with a form control
Signed-off-by: Antoine Rey <antoine.rey@free.fr>
1 parent 9f7aa2c commit c1c5731

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/resources/templates/fragments/inputField.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div th:with="valid=${!#fields.hasErrors(name)}"
66
th:class="${'form-group' + (valid ? '' : ' has-error')}"
77
class="form-group">
8-
<label class="col-sm-2 control-label" th:text="${label}">Label</label>
8+
<label th:for="${name}" class="col-sm-2 control-label" th:text="${label}">Label</label>
99
<div class="col-sm-10">
1010
<div th:switch="${type}">
1111
<input th:case="'text'" class="form-control" type="text" th:field="*{__${name}__}" />

src/main/resources/templates/fragments/selectField.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div th:with="valid=${!#fields.hasErrors(name)}"
66
th:class="${'form-group' + (valid ? '' : ' has-error')}"
77
class="form-group">
8-
<label class="col-sm-2 control-label" th:text="${label}">Label</label>
8+
<label th:for="${name}" class="col-sm-2 control-label" th:text="${label}">Label</label>
99

1010
<div class="col-sm-10">
1111
<select th:field="*{__${name}__}">

0 commit comments

Comments
 (0)