TextField<Integer> t = new TextField<Integer>("xyz") {
@Override public final <C> IConverter<C> getConverter(Class<C> clazz) { return (IConverter<C>) new IntegerConverter() { @Override protected ConversionException newConversionException(String message, Object value, Locale locale) { return new ConversionException(message).setSourceValue(value) .setTargetType(getTargetType()) .setConverter(this) .setLocale(locale) .setResourceKey("integerKey"); <---------- } }; } }; The integerKey : the key in the Application.properties for the message François Meillet Formation Wicket - Développement Wicket Le 11 juil. 2014 à 21:11, Jack Berg <erki.pub...@gmail.com> a écrit : > Hello! > > I have textfield backed by Integer Model object in the web app and a number > field in the database. > The maximum number the database can hold is less than Integer.MAX_VALUE so I > have added a validator which checks that and reports the valid range. > > The problem is that when the user enters a value larger than > Integer.MAX_VALUE, the conversion fails and user recieves a generic message. > > Using BigInteger and BigDecimal everywhere in models seems excessive. > And it seems I can't validate the raw input string before conversion? Would > you consider adding this feature or is there a better way? > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Validate-FormComponent-raw-input-before-conversion-tp4666560.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 >