fix #224 null user when invalid pet form

This commit is contained in:
oguzcagiran 2017-02-24 20:46:43 +03:00
parent f792522b3d
commit df61c116c8
2 changed files with 2 additions and 1 deletions

View file

@ -105,6 +105,7 @@ class PetController {
if (result.hasErrors()) {
pet.setOwner(owner);
model.put("pet", pet);
model.put("owner", owner);
return VIEWS_PETS_CREATE_OR_UPDATE_FORM;
} else {
owner.addPet(pet);

View file

@ -13,7 +13,7 @@
<div class="form-group">
<label class="col-sm-2 control-label">Owner</label>
<div class="col-sm-10">
<span th:text="${pet.owner?.firstName + ' ' + pet.owner?.lastName}" />
<span th:text="${owner.firstName + ' ' + owner.lastName}" />
</div>
</div>
<input