Consider below sample, which checks if fromDate and toDate are valid dates and if fromDate is less than toDate:
@CustomValidator(type = "DateValidator",
fieldName = "fromDate",
shortCircuit = true),
@CustomValidator(type = "DateValidator",
fieldName = "toDate",
shortCircuit = true),
@CustomValidator(type = "CompareDatesValidator",
message = "validate.date.jalali.same.or.before",
shortCircuit = true,
parameters = {
@ValidationParameter(name = "fromDateParam", value = "${fromDate}"),
@ValidationParameter(name = "toDateParam", value = "${toDate}")
})
The DateValidator extends the FieldValidatorSupport and the CompareDatesValidator extends the ValidatorSupport
Although I have shortCircuit the DateValidators, but the CompareDatesValidator always run, which is not correct. Can I fix this ?!