-4

I was asked to add a validation to the "date field". Only the present or a future date is allowed.Otherwise it shows an error message.

Hudaibia
  • 1
  • 4
  • 1
    Possible duplicate of [Spring MVC form validation Date field](https://stackoverflow.com/questions/24053139/spring-mvc-form-validation-date-field) – Akshar Patel Aug 08 '17 at 05:27
  • Are you using datepicker?? – Gen Aug 08 '17 at 06:14
  • You may find this link helpful https://stackoverflow.com/questions/40482252/validation-of-a-date-with-hibernate – Perry Aug 08 '17 at 10:26

1 Answers1

4

You can do this with javascript. If you want to do this in frontend.Below is the answer

To make any past dates unselectable, you first have to find the instantiation of the datepicker, and set the minDate setting to zero.

$('element').datepicker({
    minDate : 0
});
Gen
  • 2,400
  • 4
  • 24
  • 46