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

Lists in Python -

android - can not access to progress bar in an other activity -

java - Vaadin 7 Pass Data Between Views -