mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-04-25 03:42:48 +00:00
Merge pull request #303 from arey:feature/date
* pr/303: Add placeholder YYYY-MM-DD for date input field
This commit is contained in:
commit
ce262966e9
4 changed files with 16 additions and 12 deletions
|
@ -1,14 +1,18 @@
|
||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
<form>
|
<form>
|
||||||
<th:block th:fragment="input (label, name)">
|
<th:block th:fragment="input (label, name, type)">
|
||||||
<div th:with="valid=${!#fields.hasErrors(name)}"
|
<div th:with="valid=${!#fields.hasErrors(name)}"
|
||||||
th:class="${'form-group' + (valid ? '' : ' has-error')}"
|
th:class="${'form-group' + (valid ? '' : ' has-error')}"
|
||||||
class="form-group">
|
class="form-group">
|
||||||
<label class="col-sm-2 control-label" th:text="${label}">Label</label>
|
<label class="col-sm-2 control-label" th:text="${label}">Label</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<input class="form-control" type="text"
|
<div th:switch="${type}">
|
||||||
th:field="*{__${name}__}" />
|
<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}"
|
<span th:if="${valid}"
|
||||||
class="glyphicon glyphicon-ok form-control-feedback"
|
class="glyphicon glyphicon-ok form-control-feedback"
|
||||||
aria-hidden="true"></span>
|
aria-hidden="true"></span>
|
||||||
|
|
|
@ -7,15 +7,15 @@
|
||||||
<form th:object="${owner}" class="form-horizontal" id="add-owner-form" method="post">
|
<form th:object="${owner}" class="form-horizontal" id="add-owner-form" method="post">
|
||||||
<div class="form-group has-feedback">
|
<div class="form-group has-feedback">
|
||||||
<input
|
<input
|
||||||
th:replace="~{fragments/inputField :: input ('First Name', 'firstName')}" />
|
th:replace="~{fragments/inputField :: input ('First Name', 'firstName', 'text')}" />
|
||||||
<input
|
<input
|
||||||
th:replace="~{fragments/inputField :: input ('Last Name', 'lastName')}" />
|
th:replace="~{fragments/inputField :: input ('Last Name', 'lastName', 'text')}" />
|
||||||
<input
|
<input
|
||||||
th:replace="~{fragments/inputField :: input ('Address', 'address')}" />
|
th:replace="~{fragments/inputField :: input ('Address', 'address', 'text')}" />
|
||||||
<input
|
<input
|
||||||
th:replace="~{fragments/inputField :: input ('City', 'city')}" />
|
th:replace="~{fragments/inputField :: input ('City', 'city', 'text')}" />
|
||||||
<input
|
<input
|
||||||
th:replace="~{fragments/inputField :: input ('Telephone', 'telephone')}" />
|
th:replace="~{fragments/inputField :: input ('Telephone', 'telephone', 'text')}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-offset-2 col-sm-10">
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input
|
<input
|
||||||
th:replace="~{fragments/inputField :: input ('Name', 'name')}" />
|
th:replace="~{fragments/inputField :: input ('Name', 'name', 'text')}" />
|
||||||
<input
|
<input
|
||||||
th:replace="~{fragments/inputField :: input ('Birth Date', 'birthDate')}" />
|
th:replace="~{fragments/inputField :: input ('Birth Date', 'birthDate', 'date')}" />
|
||||||
<input
|
<input
|
||||||
th:replace="~{fragments/selectField :: select ('Type', 'type', ${types})}" />
|
th:replace="~{fragments/selectField :: select ('Type', 'type', ${types})}" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -31,9 +31,9 @@
|
||||||
<form th:object="${visit}" class="form-horizontal" method="post">
|
<form th:object="${visit}" class="form-horizontal" method="post">
|
||||||
<div class="form-group has-feedback">
|
<div class="form-group has-feedback">
|
||||||
<input
|
<input
|
||||||
th:replace="~{fragments/inputField :: input ('Date', 'date')}" />
|
th:replace="~{fragments/inputField :: input ('Date', 'date', 'date')}" />
|
||||||
<input
|
<input
|
||||||
th:replace="~{fragments/inputField :: input ('Description', 'description')}" />
|
th:replace="~{fragments/inputField :: input ('Description', 'description', 'text')}" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
Loading…
Reference in a new issue