Hello Sven, I ran some tests and in the tests everything is working. But when I run the application it does not.
// This is the offending code. fijo = new TextField<String>("telefono"); fijo.setConvertEmptyInputStringToNull(false); fijo.add(new StringValidator.ExactLengthValidator(9)); fijo.setRequired(false); contactsForm.add(fijo); If I leave the TextField empty and push submit I get: El campo 'telefono' debe tener exactamente 9 caracteres. Translated: The field 'phone' must have 9 characters -> I think I customized the message with a property file. So it's really not working. What else can it be? Thank you in advance. El sáb, 06-10-2012 a las 21:03 +0200, Sven Meier escribió: > > ... when the field is not required ... it should let go the field if empty > > but should run > > the validator if the field has something in it. > > This is exactly how it works. The following test shows it: > > > https://git-wip-us.apache.org/repos/asf?p=wicket.git;a=commitdiff;h=d3f3b43e > > Why to you think the actual behavior is different? > > Sven > > > On 10/06/2012 02:15 PM, Gonzalo Aguilar Delgado wrote: > > Hello, > > > > I've found a little issue with validators. > > > > When you set an StringValidator.ExactLengthValidator(9) into a TextField > > it requires you to enter exactly 9 chars. > > > > This seems to be okay. But what happens when the field is not required. > > setRequired(false). What's the correct behavior?! > > > > > > It should let go the field if empty but should run the validator if the > > field has something in it. > > > > This is not the actual behavior. Should I open a bug report? > > > > Best regards... > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org >