Hi, I have created form validator classes as shown below. The problem is that the code is not picking up messages from the corresponding 'FromDateBeforeToDate.properties' file in the same package. It works if the messages are in the page.properties or application.properties file.
I can see works OK for class implementing IValidator but can't seem to make it work for class extending AbstractFormValidator. Are my expectations wrong? If not then please tell me how I can fix the code. public class FromDateBeforeToDate extends AbstractFormValidator { /** * */ private static final long serialVersionUID = 3503966266288025266L; DateField fromDateFormComponent; DateField toDateFormComponent; public FromDateBeforeToDate( DateField fromDateFormComponent, DateField toDateFormComponent) { if (fromDateFormComponent == null) { throw new IllegalArgumentException("Argument dateFromFormComponent cannot be null"); } this.fromDateFormComponent = fromDateFormComponent; if (toDateFormComponent == null) { throw new IllegalArgumentException("Argument dateToFormComponent cannot be null"); } this.toDateFormComponent = toDateFormComponent; } @Override public FormComponent<?>[] getDependentFormComponents() { return new FormComponent<?>[] { fromDateFormComponent, toDateFormComponent, }; } @Override public void validate(Form<?> form) { Date fromDate = fromDateFormComponent.getConvertedInput(); Date toDate = toDateFormComponent.getConvertedInput(); if ( fromDate != null && toDate != null && fromDate.after(toDate)) { //error(fromDateFormComponent, "fromDateAfterToDate"); ValidationError error = new ValidationError(); error.addMessageKey(getClass().getSimpleName() + "." + "fromDateAfterToDate"); fromDateFormComponent.newValidatable().error(error); //this.error(fromDateFormComponent); } } } FromDateBeforeToDate.properties #fromDateAfterToDate=Invalid input: The '${label}' date is after the '${label}' date FromDateBeforeToDate.fromDateAfterToDate=Invalid input: The '${label}' date is after the '${label}' date Thanks. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/FormValidators-and-messages-property-file-tp4667767.html Sent from the Users forum mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org