Hi again group, I have the following problem. I use a DateValidator.range(min,
max) to add a validation to a text field.
Everything works fine, but as soon as I change the locale to german, french,
or italian, it does not validate again. It keeps validating wether or not is
required but not the range.
What could it be?
Is it because I don't have the proper message under the german and french
locales but the messages are there for the default locale (in this case
english) ? could this be?
Here is the code:
...
//Create date of birth label, text field, and date picker
WebMarkupContainer dateOfBirthLabel = new
WebMarkupContainer("dateOfBirthLabel");
//add label
form.add(dateOfBirthLabel);
//create textfield - validate it with the Date type
TextField dateOfBirth = new TextField("dateOfBirth", Date.class);
//add a validator for range between a person born a maximum of 100
years ago and today
dateOfBirth.add(DateValidator.range(getMinimumDateAllowedForDateOfBirth(),
getMaximumDateAllowedForDateOfBirth()));
//set also as required
dateOfBirth.setRequired(true);
//add the textfield
form.add(dateOfBirth);
//Create DatePicker
DatePicker datePicker = new DatePicker("datePicker",
dateOfBirthLabel, dateOfBirth);
//create date converter
DateConverter dateConverter = new DateConverter();
//Set the DateFormat and Locales
dateConverter.setDateFormat(getWicketSession().getLocale(), new
SimpleDateFormat("dd.MM.yyyy"));
//asign the converter to the date picker
datePicker.setDateConverter(dateConverter);
//Add the datepicker
form.add(datePicker);
....
private Date getMinimumDateAllowedForDateOfBirth(){
Calendar now = Calendar.getInstance();
now.add(Calendar.YEAR, -MAXIMUM_LIFE_EXPECTANCY);
//MAXIMUM_LIFE_EXPECTANCY=100
return now.getTime();
}
private Date getMaximumDateAllowedForDateOfBirth(){
Calendar now = Calendar.getInstance();
return now.getTime();
}
....
f(t)
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user