Hi all (and sorry for my english)
I have a problem with my validator:
class MoreThanDateValidator implements Validator {
Date date;
public void validate(Object value) throws InvalidValueException {
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");
if (!isValid(value))
{
logger.debug("!isValid, value: " + value);
throw new InvalidValueException("input the date more than "
+ sdf.format(date));
}
}
MoreThanDateValidator(Date _date) {
date = _date;
}
public boolean isValid(Object value) {
logger.debug("isValid, value: " + value);
if (date == null)
return true;
if (value == null)
return true;
Date curDate = (Date) value;
return (curDate.after(date) || curDate.equals(date));
}
}
This validator must validate dateFields. It works ok, but error message don’t hide when I input right value.
example:
a date in validator: 10.10.2010
an input value: 07.10.2010
message: input the date more than 10.10.2010
new input value 12.10.2010
press commit
message didn’t hide… (but commiting was worked)
help me to understand this problem please, thanks.