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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -