basic validation

This commit is contained in:
Jottyfan
2022-12-08 23:03:50 +01:00
parent df7e4e7f0e
commit 2e376291c5
12 changed files with 174 additions and 35 deletions

View File

@ -21,41 +21,50 @@
<div class="container">
<div class="row">
<div class="col-sm-6 rowdist">
<input type="text" class="form-control" placeholder="Vorname" th:field="*{forename}" />
<span class="error" th:each="error : ${#fields.errors('surname')}">[[${error}]]<br /></span>
<input type="text" placeholder="Vorname" th:field="*{forename}" th:class="${#fields.hasErrors('forename') ? 'inputerror' : 'form-control'}" />
</div>
<div class="col-sm-6 rowdist">
<input type="text" class="form-control" placeholder="Nachname" th:field="*{surname}" />
<span class="error" th:each="error : ${#fields.errors('forename')}">[[${error}]]<br /></span>
<input type="text" placeholder="Nachname" th:field="*{surname}" th:class="${#fields.hasErrors('surname') ? 'inputerror' : 'form-control'}" />
</div>
</div>
<div class="row">
<div class="col-sm-6 rowdist">
<select class="form-select" th:field="*{sex}">
<span class="error" th:each="error : ${#fields.errors('sex')}">[[${error}]]<br /></span>
<select th:field="*{sex}" th:class="${#fields.hasErrors('sex') ? 'inputerror' : 'form-select'}">
<option value="">Geschlecht</option>
<option value="female">weiblich</option>
<option value="male">männlich</option>
</select>
</div>
<div class="col-sm-6 rowdist">
<input type="date" class="form-control" placeholder="Geburtsdatum" th:field="*{birthDate}" />
<span class="error" th:each="error : ${#fields.errors('birthDate')}">[[${error}]]<br /></span>
<input type="date" placeholder="Geburtsdatum" th:field="*{birthDate}" th:class="${#fields.hasErrors('birthDate') ? 'inputerror' : 'form-control'}" />
</div>
</div>
<div class="row">
<div class="col-sm-6 rowdist">
<input type="text" class="form-control" placeholder="Straße und Hausnummer" th:field="*{street}" />
<span class="error" th:each="error : ${#fields.errors('street')}">[[${error}]]<br /></span>
<input type="text" placeholder="Straße und Hausnummer" th:field="*{street}" th:class="${#fields.hasErrors('street') ? 'inputerror' : 'form-control'}" />
</div>
<div class="col-sm-2 rowdist">
<input type="text" class="form-control" placeholder="PLZ" th:field="*{zip}" />
<span class="error" th:each="error : ${#fields.errors('zip')}">[[${error}]]<br /></span>
<input type="text" placeholder="PLZ" th:field="*{zip}" th:class="${#fields.hasErrors('zip') ? 'inputerror' : 'form-control'}" />
</div>
<div class="col-sm-4 rowdist">
<input type="text" class="form-control" placeholder="Ort" th:field="*{city}" />
<span class="error" th:each="error : ${#fields.errors('city')}">[[${error}]]<br /></span>
<input type="text" placeholder="Ort" th:field="*{city}" th:class="${#fields.hasErrors('city') ? 'inputerror' : 'form-control'}" />
</div>
</div>
<div class="row">
<div class="col-sm-6 rowdist">
<input type="text" class="form-control" placeholder="E-Mail" th:field="*{email}" />
<span class="error" th:each="error : ${#fields.errors('email')}">[[${error}]]<br /></span>
<input type="text" placeholder="E-Mail" th:field="*{email}" th:class="${#fields.hasErrors('email') ? 'inputerror' : 'form-control'}" />
</div>
<div class="col-sm-6 rowdist">
<input type="text" class="form-control" placeholder="Telefonnummer" th:field="*{phone}" />
<span class="error" th:each="error : ${#fields.errors('phone')}">[[${error}]]<br /></span>
<input type="text" placeholder="Telefonnummer" th:field="*{phone}" th:class="${#fields.hasErrors('phone') ? 'inputerror' : 'form-control'}" />
</div>
</div>
<div class="row">
@ -63,7 +72,8 @@
<span>mitkommen als</span>
</div>
<div class="col-sm-6 rowdist">
<select class="form-select" th:field="*{campRole}">
<span class="error" th:each="error : ${#fields.errors('campRole')}">[[${error}]]<br /></span>
<select th:field="*{campRole}" th:class="${#fields.hasErrors('campRole') ? 'inputerror' : 'form-select'}">
<option value="student">Teilnehmer</option>
<option value="teacher">Mitarbeiter</option>
<option value="feeder">Küchenteam</option>
@ -86,10 +96,12 @@
</div>
<div id="createlogin" class="row">
<div class="col-sm-6 rowdist">
<input type="text" class="form-control" placeholder="Login" th:field="*{login}" />
<span class="error" th:each="error : ${#fields.errors('login')}">[[${error}]]<br /></span>
<input type="text" placeholder="Login" th:field="*{login}" th:class="${#fields.hasErrors('login') ? 'inputerror' : 'form-control'}" />
</div>
<div class="col-sm-6 rowdist">
<input type="password" class="form-control" placeholder="Passwort" th:field="*{password}" />
<span class="error" th:each="error : ${#fields.errors('password')}">[[${error}]]<br /></span>
<input type="password" placeholder="Passwort" th:field="*{password}" th:class="${#fields.hasErrors('password') ? 'inputerror' : 'form-control'}" />
</div>
</div>
<div class="row">