On Thu, 2006-06-08 at 08:01 -0600, Jason Johnston wrote:
> Antonio Gallardo wrote:
> > [EMAIL PROTECTED] escribió:
> >> OK. I think I found it in Field.java, where it does
> >>
> >> newEnteredValue = newEnteredValue.trim();
> >>   
> > Hi Fernando,
> > 
> > Great you found it! You should can create a patch to optionally 
> > configure leading spaces and keeping the former behavior as the default 
> > behavior. WDYT?
> 
> FWIW I think this might best be implemented in the Convertor layer, that 
> seems most appropriate for converting untrimmed strings to trimmed and 
> vice versa.  A PlainStringConvertor for instance would keep 
> leading/trailing whitespace intact.  WDYT?
> 
> If Fernando doesn't want to create a patch I will do so since this has 
> annoyed me in the past as well.

Cool!

If you do it on the convertor layer, it would mean that every convertor
needs to handle whitespace for itself. For example, a date field
containing just a space would currently be treated as an empty input,
while otherwise it would be up to the date convertor to detect this.
This probably isn't a huge problem, a simple trim() and empty string
check at the start of the existing convertors could solve this.

If you go for the convertor approach, I would suggest to make the
default string convertor configurable, instead of creating multiple
convertors.

For example, using a whitespace attribute that could have the following
values:

whitespace="preserve|trim|trim-left|trim-right"

and possibly a trim-if-all-whitespace attribute to force trimming in
case the input contains only whitespace.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]                          [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to