html - thymeleaf pattern dd/MM/yyyy -
i try validate input date have format dd/mm/yyyy :
<input type="date" th:pattern="${date_format}" th:field="*{subscriptiondate}"/>
in controller, add attribute model :
model.addattribute("date_format", "dd/mm/yyyy");
but when submit form have message input tag :
please respect format
i solve problem updating model attribute :
model.addattribute("date_format", "\d{1,2}/\d{1,2}/\d{4}");
Comments
Post a Comment