You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Fe...@thomson.com on 2006/06/06 15:57:49 UTC
CForms: leading spaces dissapearing
I have a text field in a CForm, and when it is submitted, the leading
spaces
in the text dissapear.
I am using Cocoon 2.1.8
Is there any way to disable this behavior?
Thanks
Re: CForms: leading spaces dissapearing
Posted by Jason Johnston <co...@lojjic.net>.
Bruno Dumon wrote:
> On Thu, 2006-06-08 at 08:01 -0600, Jason Johnston wrote:
>> Antonio Gallardo wrote:
>> 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.
>
FYI I just opened issue http://issues.apache.org/jira/browse/COCOON-1879
and attached a patch. I ended up going with your recommendation for a
whitespace="" attribute on fd:field rather than doing it in the
convertors; it's definitely the simpler approach, and less of a hassle
to maintain.
--Jason
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForms: leading spaces dissapearing
Posted by Bruno Dumon <br...@outerthought.org>.
On Thu, 2006-06-08 at 08:01 -0600, Jason Johnston wrote:
> Antonio Gallardo wrote:
> > Fernando.Matomira@thomson.com 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
bruno@outerthought.org bruno@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForms: leading spaces dissapearing
Posted by Jason Johnston <co...@lojjic.net>.
Antonio Gallardo wrote:
> Fernando.Matomira@thomson.com 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.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: CForms: leading spaces dissapearing
Posted by Fe...@thomson.com.
This is a tool that performs edit operations onto multiple documents at the same time.
I have a field to append text to a selected section of the documents.
If the user does not want the new text to be stuck immediately
after the existing one, he needs to start the append text with a space
or other separator, like a comma, depending on the case.
-----Original Message-----
From: Antonio Gallardo [mailto:agallardo@agssa.net]
Sent: Thursday, June 08, 2006 8:22 AM
To: users@cocoon.apache.org
Subject: Re: CForms: leading spaces dissapearing
Fernando.Matomira@thomson.com 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?
BTW, I wonder why you need to keep leading spaces. Can you explain your
use case?
Best Regards,
Antonio Gallardo.
> -----Original Message-----
> From: Mato Mira, Fernando (DIA CHE)
> Sent: Wednesday, June 07, 2006 11:19 AM
> To: users@cocoon.apache.org
> Subject: RE: CForms: leading spaces dissapearing
>
> This behavior is unacceptable. Where is it in the source code so that I
> can hardcode disable it in my copy of Cocoon?
>
> Thanks
>
> -----Original Message-----
> From: Bruno Dumon [mailto:bruno@outerthought.org]
> Sent: Wednesday, June 07, 2006 10:23 AM
> To: users@cocoon.apache.org
> Subject: Re: CForms: leading spaces dissapearing
>
> On Tue, 2006-06-06 at 15:57 +0200, Fernando.Matomira@thomson.com wrote:
>
>> I have a text field in a CForm, and when it is submitted, the leading
>> spaces
>>
>> in the text dissapear.
>>
>>
>>
>> I am using Cocoon 2.1.8
>>
>> Is there any way to disable this behavior?
>>
>>
>
> nope, this behaviour is currently hardcoded in the field widget. It is a
> todo item to make this configurable.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForms: leading spaces dissapearing
Posted by Antonio Gallardo <ag...@agssa.net>.
Fernando.Matomira@thomson.com 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?
BTW, I wonder why you need to keep leading spaces. Can you explain your
use case?
Best Regards,
Antonio Gallardo.
> -----Original Message-----
> From: Mato Mira, Fernando (DIA CHE)
> Sent: Wednesday, June 07, 2006 11:19 AM
> To: users@cocoon.apache.org
> Subject: RE: CForms: leading spaces dissapearing
>
> This behavior is unacceptable. Where is it in the source code so that I
> can hardcode disable it in my copy of Cocoon?
>
> Thanks
>
> -----Original Message-----
> From: Bruno Dumon [mailto:bruno@outerthought.org]
> Sent: Wednesday, June 07, 2006 10:23 AM
> To: users@cocoon.apache.org
> Subject: Re: CForms: leading spaces dissapearing
>
> On Tue, 2006-06-06 at 15:57 +0200, Fernando.Matomira@thomson.com wrote:
>
>> I have a text field in a CForm, and when it is submitted, the leading
>> spaces
>>
>> in the text dissapear.
>>
>>
>>
>> I am using Cocoon 2.1.8
>>
>> Is there any way to disable this behavior?
>>
>>
>
> nope, this behaviour is currently hardcoded in the field widget. It is a
> todo item to make this configurable.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: CForms: leading spaces dissapearing
Posted by Fe...@thomson.com.
OK. I think I found it in Field.java, where it does
newEnteredValue = newEnteredValue.trim();
-----Original Message-----
From: Mato Mira, Fernando (DIA CHE)
Sent: Wednesday, June 07, 2006 11:19 AM
To: users@cocoon.apache.org
Subject: RE: CForms: leading spaces dissapearing
This behavior is unacceptable. Where is it in the source code so that I
can hardcode disable it in my copy of Cocoon?
Thanks
-----Original Message-----
From: Bruno Dumon [mailto:bruno@outerthought.org]
Sent: Wednesday, June 07, 2006 10:23 AM
To: users@cocoon.apache.org
Subject: Re: CForms: leading spaces dissapearing
On Tue, 2006-06-06 at 15:57 +0200, Fernando.Matomira@thomson.com wrote:
> I have a text field in a CForm, and when it is submitted, the leading
> spaces
>
> in the text dissapear.
>
>
>
> I am using Cocoon 2.1.8
>
> Is there any way to disable this behavior?
>
nope, this behaviour is currently hardcoded in the field widget. It is a
todo item to make this configurable.
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org bruno@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: CForms: leading spaces dissapearing
Posted by Fe...@thomson.com.
This behavior is unacceptable. Where is it in the source code so that I
can hardcode disable it in my copy of Cocoon?
Thanks
-----Original Message-----
From: Bruno Dumon [mailto:bruno@outerthought.org]
Sent: Wednesday, June 07, 2006 10:23 AM
To: users@cocoon.apache.org
Subject: Re: CForms: leading spaces dissapearing
On Tue, 2006-06-06 at 15:57 +0200, Fernando.Matomira@thomson.com wrote:
> I have a text field in a CForm, and when it is submitted, the leading
> spaces
>
> in the text dissapear.
>
>
>
> I am using Cocoon 2.1.8
>
> Is there any way to disable this behavior?
>
nope, this behaviour is currently hardcoded in the field widget. It is a
todo item to make this configurable.
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org bruno@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForms: leading spaces dissapearing
Posted by Bruno Dumon <br...@outerthought.org>.
On Tue, 2006-06-06 at 15:57 +0200, Fernando.Matomira@thomson.com wrote:
> I have a text field in a CForm, and when it is submitted, the leading
> spaces
>
> in the text dissapear.
>
>
>
> I am using Cocoon 2.1.8
>
> Is there any way to disable this behavior?
>
nope, this behaviour is currently hardcoded in the field widget. It is a
todo item to make this configurable.
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org bruno@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org