On 6 March 2011 16:11, anton dos santos <adsantos@free.fr> wrote:
I also tried StrictValidation="true" and an intValidator that accepts empty input by overriding isValid():
   public boolean isValid(String text) {
       final ParsePosition pos = new ParsePosition(0);
       Object obj = format.parseObject(text, pos);
       if( obj == null || text.length() == 0) {
         return true;
       }

       // the text is only valid is we successfully parsed ALL of it. Don't want trailing bits of
       // not-valid text.
       return obj != null && pos.getErrorIndex() == -1 && pos.getIndex() == text.length();
   }
this works fine until user erases everything in the TextInput, from then on use can enter any character, he is no longer limited to digits.

What else could I try ?


This seems to work for me.


public class XXXIntRangeValidator extends IntRangeValidator {
  // Constructors...

  @Override
  public boolean isValid(String text) {
    return (text.length() == 0) || super.isValid(text); 
  }
}