You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Richard Frovarp <rf...@apache.org> on 2014/02/11 20:10:35 UTC

Trimming strings

Upon insert I want to trim strings going into the database. Is there an 
easy way to configure this?

I know I can override all of the appropriate functions for my settings 
and use StringUtils.trim(), then call super, but I would like an easier 
method that I'm less likely to forget to do.

Thanks,
Richard

Re: Trimming strings

Posted by Michael Gentry <mg...@masslight.net>.
Sweet!

Keep in mind it isn't a good solution for a heavily trafficked web site
since it adds server load.  You could also do JS onChange handlers on all
your textfields and let the browsers trim the inputs.

mrg



On Wed, Feb 12, 2014 at 9:24 AM, Richard Frovarp <rf...@apache.org>wrote:

> Exactly what I needed. Thank you very much.
>
>
> On 02/11/2014 02:56 PM, Michael Gentry wrote:
>
>> I made a Gist for you to keep the list less cluttered and preserve
>> formatting/etc (since the mailer would mess it up):
>>
>> https://gist.github.com/mrg/8943683
>>
>> HTH,
>>
>> mrg
>>
>> On Tue, Feb 11, 2014 at 3:07 PM, Richard Frovarp <rfrovarp@apache.org
>> >wrote:
>>
>>  This is the wrong list, but how did you accomplish triming the form
>>> inputs? Is there one of those wonderful hidden ways to do that everywhere
>>> by default? That would accomplish my goals as well, as I am using
>>> Tapestry
>>> too.
>>>
>>>
>>> On 02/11/2014 01:54 PM, Michael Gentry wrote:
>>>
>>>  You could also use custom templates or, if a web application, hit it
>>>> with
>>>> a
>>>> big hammer and trim all form inputs every submit (that's what I did in a
>>>> Tapestry application).
>>>>
>>>>
>>>> On Tue, Feb 11, 2014 at 2:31 PM, John Huss <jo...@gmail.com> wrote:
>>>>
>>>>   You can subclass CayenneDataObject and override writePropertyDirectly.
>>>>
>>>>>    That should do it.
>>>>>
>>>>>
>>>>> On Tue, Feb 11, 2014 at 1:10 PM, Richard Frovarp <rfrovarp@apache.org
>>>>>
>>>>>  wrote:
>>>>>>
>>>>>>
>>>>>   Upon insert I want to trim strings going into the database. Is there
>>>>> an
>>>>>
>>>>>> easy way to configure this?
>>>>>>
>>>>>> I know I can override all of the appropriate functions for my settings
>>>>>>
>>>>>>  and
>>>>>
>>>>>  use StringUtils.trim(), then call super, but I would like an easier
>>>>>>
>>>>>>  method
>>>>>
>>>>>  that I'm less likely to forget to do.
>>>>>>
>>>>>> Thanks,
>>>>>> Richard
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: Trimming strings

Posted by Richard Frovarp <rf...@apache.org>.
Exactly what I needed. Thank you very much.

On 02/11/2014 02:56 PM, Michael Gentry wrote:
> I made a Gist for you to keep the list less cluttered and preserve
> formatting/etc (since the mailer would mess it up):
>
> https://gist.github.com/mrg/8943683
>
> HTH,
>
> mrg
>
> On Tue, Feb 11, 2014 at 3:07 PM, Richard Frovarp <rf...@apache.org>wrote:
>
>> This is the wrong list, but how did you accomplish triming the form
>> inputs? Is there one of those wonderful hidden ways to do that everywhere
>> by default? That would accomplish my goals as well, as I am using Tapestry
>> too.
>>
>>
>> On 02/11/2014 01:54 PM, Michael Gentry wrote:
>>
>>> You could also use custom templates or, if a web application, hit it with
>>> a
>>> big hammer and trim all form inputs every submit (that's what I did in a
>>> Tapestry application).
>>>
>>>
>>> On Tue, Feb 11, 2014 at 2:31 PM, John Huss <jo...@gmail.com> wrote:
>>>
>>>   You can subclass CayenneDataObject and override writePropertyDirectly.
>>>>    That should do it.
>>>>
>>>>
>>>> On Tue, Feb 11, 2014 at 1:10 PM, Richard Frovarp <rfrovarp@apache.org
>>>>
>>>>> wrote:
>>>>>
>>>>
>>>>   Upon insert I want to trim strings going into the database. Is there an
>>>>> easy way to configure this?
>>>>>
>>>>> I know I can override all of the appropriate functions for my settings
>>>>>
>>>> and
>>>>
>>>>> use StringUtils.trim(), then call super, but I would like an easier
>>>>>
>>>> method
>>>>
>>>>> that I'm less likely to forget to do.
>>>>>
>>>>> Thanks,
>>>>> Richard
>>>>>
>>>>>
>>>>
>>>
>>
>


Re: Trimming strings

Posted by Michael Gentry <mg...@masslight.net>.
I made a Gist for you to keep the list less cluttered and preserve
formatting/etc (since the mailer would mess it up):

https://gist.github.com/mrg/8943683

HTH,

mrg

On Tue, Feb 11, 2014 at 3:07 PM, Richard Frovarp <rf...@apache.org>wrote:

> This is the wrong list, but how did you accomplish triming the form
> inputs? Is there one of those wonderful hidden ways to do that everywhere
> by default? That would accomplish my goals as well, as I am using Tapestry
> too.
>
>
> On 02/11/2014 01:54 PM, Michael Gentry wrote:
>
>> You could also use custom templates or, if a web application, hit it with
>> a
>> big hammer and trim all form inputs every submit (that's what I did in a
>> Tapestry application).
>>
>>
>> On Tue, Feb 11, 2014 at 2:31 PM, John Huss <jo...@gmail.com> wrote:
>>
>>  You can subclass CayenneDataObject and override writePropertyDirectly.
>>>   That should do it.
>>>
>>>
>>> On Tue, Feb 11, 2014 at 1:10 PM, Richard Frovarp <rfrovarp@apache.org
>>>
>>>> wrote:
>>>>
>>>
>>>  Upon insert I want to trim strings going into the database. Is there an
>>>> easy way to configure this?
>>>>
>>>> I know I can override all of the appropriate functions for my settings
>>>>
>>> and
>>>
>>>> use StringUtils.trim(), then call super, but I would like an easier
>>>>
>>> method
>>>
>>>> that I'm less likely to forget to do.
>>>>
>>>> Thanks,
>>>> Richard
>>>>
>>>>
>>>
>>
>

Re: Trimming strings

Posted by Richard Frovarp <rf...@apache.org>.
This is the wrong list, but how did you accomplish triming the form 
inputs? Is there one of those wonderful hidden ways to do that 
everywhere by default? That would accomplish my goals as well, as I am 
using Tapestry too.

On 02/11/2014 01:54 PM, Michael Gentry wrote:
> You could also use custom templates or, if a web application, hit it with a
> big hammer and trim all form inputs every submit (that's what I did in a
> Tapestry application).
>
>
> On Tue, Feb 11, 2014 at 2:31 PM, John Huss <jo...@gmail.com> wrote:
>
>> You can subclass CayenneDataObject and override writePropertyDirectly.
>>   That should do it.
>>
>>
>> On Tue, Feb 11, 2014 at 1:10 PM, Richard Frovarp <rfrovarp@apache.org
>>> wrote:
>>
>>> Upon insert I want to trim strings going into the database. Is there an
>>> easy way to configure this?
>>>
>>> I know I can override all of the appropriate functions for my settings
>> and
>>> use StringUtils.trim(), then call super, but I would like an easier
>> method
>>> that I'm less likely to forget to do.
>>>
>>> Thanks,
>>> Richard
>>>
>>
>


Re: Trimming strings

Posted by Michael Gentry <mg...@masslight.net>.
You could also use custom templates or, if a web application, hit it with a
big hammer and trim all form inputs every submit (that's what I did in a
Tapestry application).


On Tue, Feb 11, 2014 at 2:31 PM, John Huss <jo...@gmail.com> wrote:

> You can subclass CayenneDataObject and override writePropertyDirectly.
>  That should do it.
>
>
> On Tue, Feb 11, 2014 at 1:10 PM, Richard Frovarp <rfrovarp@apache.org
> >wrote:
>
> > Upon insert I want to trim strings going into the database. Is there an
> > easy way to configure this?
> >
> > I know I can override all of the appropriate functions for my settings
> and
> > use StringUtils.trim(), then call super, but I would like an easier
> method
> > that I'm less likely to forget to do.
> >
> > Thanks,
> > Richard
> >
>

Re: Trimming strings

Posted by John Huss <jo...@gmail.com>.
You can subclass CayenneDataObject and override writePropertyDirectly.
 That should do it.


On Tue, Feb 11, 2014 at 1:10 PM, Richard Frovarp <rf...@apache.org>wrote:

> Upon insert I want to trim strings going into the database. Is there an
> easy way to configure this?
>
> I know I can override all of the appropriate functions for my settings and
> use StringUtils.trim(), then call super, but I would like an easier method
> that I'm less likely to forget to do.
>
> Thanks,
> Richard
>