Menu

#6 PatternPerformer forcing input to be of type text

2.0
closed
None
2014-11-11
2014-11-10
Liam Jones
No

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.

Discussion

  • Francisco Perez Pellicena

    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

     
  • Liam Jones

    Liam Jones - 2014-11-11

    Thanks for the quick turnaround Francisco!

    2.1.2-SNAPSHOT is working as expected.

     
  • Francisco Perez Pellicena

    • status: open --> closed
    • assigned_to: Francisco Perez Pellicena
     

Log in to post a comment.