title: Add binding error messages to custom messages in input tag
body: <p>I am playing with the Spring <a href="https://spring.io/guides/gs/validating-form-input/" rel="nofollow">validating form input</a> example - java spring mvc with Thymeleaf views.  I have been able to pass messages into the view without issue.  These display where the example wants them to...</p>
  
  <p>e.g.</p>
  
  <pre><code>&lt;td th:if="${#fields.hasErrors('name')}" th:errors="*{name}"&gt;Name Error&lt;/td&gt;
  </code></pre>
  
  <p>I am trying to find a way to put them into the html input validation attributes though so I have tried the following (full page below)</p>
  
  <pre><code>&lt;td&gt;&lt;input type="text" th:field="*{age}" **required="required" data-errormessage-value-missing="${#fields.errors('age')}" data-errormessage="${#fields.errors('age')}"**/&gt;&lt;/td&gt;
  </code></pre>
  
  <p>This has done no good though and the validation message displayed is ${#fields.errors('age')} !  Is there a way to push the binding errors into the attribute or am I misunderstanding the way it works ?</p>
  
  <p>Thanks for any help in advance.</p>
  
  <p>Page html</p>
  
  <pre><code>&lt;html&gt;
  </code></pre>
  
  
  
  <pre><code>&lt;body&gt;
      &lt;form action="#" th:action="@{/}" th:object="${personForm}" method="post"&gt;
          &lt;table&gt;
              &lt;tr&gt;
                  &lt;td&gt;Name:&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" th:field="*{name}" required="required" data-errormessage-value-missing="Custom Message" /&gt;&lt;/td&gt;
  
                  &lt;td th:if="${#fields.hasErrors('name')}" th:errors="*{name}"&gt;Name Error&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;Age:&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" th:field="*{age}" required="required" data-errormessage-value-missing="${#fields.errors('age')}" data-errormessage="${#fields.errors('age')}"/&gt;&lt;/td&gt;
                  &lt;td th:if="${#fields.hasErrors('age')}" th:errors="*{age}"&gt;Age Error&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;button type="submit"&gt;Submit&lt;/button&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>