PatternPerformer forcing input to be of type text
HTML5 validation dialect for the Thymeleaf template engine
Brought to you by:
jacksonbeat,
jmiguelsamper
PatternPerformer
is doing element.setAttribute("type", "text")
during its processing but the pattern
attribute is valid for inputs of type text
, search
, url
, tel
, email
and password
(see http://www.w3.org/TR/html/forms.html#input-type-attr-summary)
If you have something like:
<form th:object="${form}" val:validate="${form}"> <th:block th:with="type=password"> <input th:type="${type}" th:object="*{password}"> </th:block> </form>
(The th:with
is an arbitrary example, in reality the th:type
value is coming from somewhere else)
And form.password
is a @Pattern
annotated field then the HTML5 validation dialect will change the input from type password
to type text
.
Hi Liam
thanks for using the dialect, we appreciate your feedback.
This issue is solved in 2.1.2-SNAPSHOT.
Now, the type attribute value remains unchanged as well as the pattern attribute is included only for the types listed in http://www.w3.org/TR/html/forms.html#input-type-attr-summary
Thanks for the quick turnaround Francisco!
2.1.2-SNAPSHOT is working as expected.