Skip to content
Snippets Groups Projects
Commit ce262966 authored by Stephane Nicoll's avatar Stephane Nicoll
Browse files

Merge pull request #303 from arey:feature/date

* pr/303:
  Add placeholder YYYY-MM-DD for date input field
parents fadf7f4d d92a4218
No related branches found
No related tags found
No related merge requests found
<html>
<body>
<form>
<th:block th:fragment="input (label, name)">
<th:block th:fragment="input (label, name, type)">
<div th:with="valid=${!#fields.hasErrors(name)}"
th:class="${'form-group' + (valid ? '' : ' has-error')}"
class="form-group">
<label class="col-sm-2 control-label" th:text="${label}">Label</label>
<div class="col-sm-10">
<input class="form-control" type="text"
th:field="*{__${name}__}" />
<div th:switch="${type}">
<input th:case="'text'" class="form-control" type="text" th:field="*{__${name}__}" />
<input th:case="'date'" class="form-control" type="text" th:field="*{__${name}__}"
placeholder="YYYY-MM-DD" title="Enter a date in this format: YYYY-MM-DD"
pattern="(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))"/>
</div>
<span th:if="${valid}"
class="glyphicon glyphicon-ok form-control-feedback"
aria-hidden="true"></span>
......
......@@ -7,15 +7,15 @@
<form th:object="${owner}" class="form-horizontal" id="add-owner-form" method="post">
<div class="form-group has-feedback">
<input
th:replace="~{fragments/inputField :: input ('First Name', 'firstName')}" />
th:replace="~{fragments/inputField :: input ('First Name', 'firstName', 'text')}" />
<input
th:replace="~{fragments/inputField :: input ('Last Name', 'lastName')}" />
th:replace="~{fragments/inputField :: input ('Last Name', 'lastName', 'text')}" />
<input
th:replace="~{fragments/inputField :: input ('Address', 'address')}" />
th:replace="~{fragments/inputField :: input ('Address', 'address', 'text')}" />
<input
th:replace="~{fragments/inputField :: input ('City', 'city')}" />
th:replace="~{fragments/inputField :: input ('City', 'city', 'text')}" />
<input
th:replace="~{fragments/inputField :: input ('Telephone', 'telephone')}" />
th:replace="~{fragments/inputField :: input ('Telephone', 'telephone', 'text')}" />
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
......
......@@ -17,9 +17,9 @@
</div>
</div>
<input
th:replace="~{fragments/inputField :: input ('Name', 'name')}" />
th:replace="~{fragments/inputField :: input ('Name', 'name', 'text')}" />
<input
th:replace="~{fragments/inputField :: input ('Birth Date', 'birthDate')}" />
th:replace="~{fragments/inputField :: input ('Birth Date', 'birthDate', 'date')}" />
<input
th:replace="~{fragments/selectField :: select ('Type', 'type', ${types})}" />
</div>
......
......@@ -31,9 +31,9 @@
<form th:object="${visit}" class="form-horizontal" method="post">
<div class="form-group has-feedback">
<input
th:replace="~{fragments/inputField :: input ('Date', 'date')}" />
th:replace="~{fragments/inputField :: input ('Date', 'date', 'date')}" />
<input
th:replace="~{fragments/inputField :: input ('Description', 'description')}" />
th:replace="~{fragments/inputField :: input ('Description', 'description', 'text')}" />
</div>
<div class="form-group">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment