-
Notifications
You must be signed in to change notification settings - Fork 23.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add birthdate validation in Pet Controller #1284
add birthdate validation in Pet Controller #1284
Conversation
src/main/java/org/springframework/samples/petclinic/owner/PetController.java
Outdated
Show resolved
Hide resolved
@@ -6,3 +6,4 @@ nonNumeric=darf nur numerisch sein | |||
duplicateFormSubmission=Wiederholtes Absenden des Formulars ist nicht erlaubt | |||
typeMismatch.date=ung�ltiges Datum | |||
typeMismatch.birthDate=ung�ltiges Datum | |||
invalid.date=Ongeldige geboortedatum. Selecteer alstublieft een geldige datum. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't German.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
german message is fixed now !
@@ -107,6 +112,18 @@ public String initUpdateForm(Owner owner, @PathVariable("petId") int petId, Mode | |||
|
|||
@PostMapping("/pets/{petId}/edit") | |||
public String processUpdateForm(@Valid Pet pet, BindingResult result, Owner owner, ModelMap model) { | |||
|
|||
if (StringUtils.hasLength(pet.getName()) && pet.isNew() && owner.getPet(pet.getName(), true) != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary - it's not a new pet, so the test will always fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are correct this was not there in the latest version .
sorry i maybe i added it by mistake
its fixed now in the new commit
Can you please squash everything down to one commit and rebase on main? Also take a look at the build failures and take the actions suggested (before you squash). |
Merged as 3be2895 |
adding birthdate for update and create Pet