• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

@AssertTrue - how to display validation message in thymeleaf?

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to compare 2 passwords to see if they match, I can do that with a field and `@AssertTrue`, however I cannot display the message if validation fails.

I am trying like so:


And in the view:



Using breakpoints, I can see that all values are correct as expected, however I **always** get the error message, even if the passwords match.

It seems that the `passFlag` does not change its value for validation even with `@AssertTrue` being true (because when I use breakpoints to see the values I can see that the `passFlag` has correct value, but I **still** get the error message).

So how can I modify the above code to work with the error message, and even better - is there a better to compare the 2 fields and display an error message if need be?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic