cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <>
Subject Re: CForms: leading spaces dissapearing
Date Thu, 08 Jun 2006 15:32:14 GMT
On Thu, 2006-06-08 at 08:01 -0600, Jason Johnston wrote:
> Antonio Gallardo wrote:
> > escribió:
> >> OK. I think I found it in, 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.


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

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


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

Bruno Dumon                   
Outerthought - Open Source, Java & XML Competence Support Center                

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message