You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bryan Lewis <br...@maine.rr.com> on 2005/02/28 16:05:31 UTC

trim() in NumberValidator

A user of our new Tapestry apps expressed surprise that numeric inputs weren't trimmed.  Pasting a number into a textfield often leaves a trailing space, and the NumberValidator rejects it. 

The javadoc for IValidator.toObject() says, "The input string will already have been trimmed."  The input does get trimmed in the checkRequired() method, but not in the final parsing of the string.  Wouldn't it be more consistent to add this one line to NumberValidator.toObject()?

            if (value != null) value = value.trim();

I could fix it locally with my own subclass of NumberValidator, but this seems like something we'd want corrected in the core.

Thanks.