1

Using Spring I need to validate a form possibly using annotations.

My html form contains an input type radio and some input text dependent on the radio value. How to validate only the input fields dependent on the current radio selected?

Slava Semushin
  • 14,904
  • 7
  • 53
  • 69
Matteo
  • 1,893
  • 2
  • 14
  • 13

2 Answers2

2

You need to write own JSR-303 validator and put it on the class. This question already been asked several times, so there some links:

In the first answer you even may find full and working example.

Community
  • 1
  • 1
Slava Semushin
  • 14,904
  • 7
  • 53
  • 69
0

If you need validate form after submit, possible use annotation @Valid, or simple frontend validation for example jquery http://jqueryvalidation.org/documentation/

Elishtar
  • 1
  • 1