You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by David Wynter <da...@btclick.com> on 2001/11/27 15:36:45 UTC

Stripping whitespace off form entries, how to?

Hello,

I had a gotcha with my Turbine application (TDK 2.1, Oracle on W2K). If the
user enters a value into a form to be stored in the database and leaves a
trailing blank (space char) on the entry it gets stored like this in the
database. When the user goes to select from a 'select' on the screen the
value shown there has had the trailing blank stripped off (I don't know
where yet) and as this is used to find the entry related to this name by
using the value passed in as a part of a criteria 'add' it never finds it.

As far as I can see there are 2 solutions.
1. Preserve the trailing blanks all the way through.
2. Strip the blanks before storing the value in the database.

In my application I do not want the trialing blanks so I need to strip them.
Next Q is where to do this, do I use Intake (which I have not used yet) or
have a convenience method that walks through the arguments and strips white
space from the end of each argument in a Parameter Parser object.

Suggestions on the best approach?

Regards

David


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Stripping whitespace off form entries, how to?

Posted by bl...@branuity.com.
I took the DefaultParameterParser approach to replace (so-called) smart
quotes with a simple quote which has been quite effective.  However,
rather than creating a convenience method I just overode getString()
directly in my extension of DefaultParameterParser.  The best thing about
putting it into the parameter parser, IMO, is that it isolates the
parameter processing from the form validation and field processing.  The
only issue is, of course, that ALL users of the derived parameter parser
will be picking up that processing whether they need it or not.  This was
the desired behavior for me since I never wanted smart quotes to show up
in my database.

-B

On Tue, 27 Nov 2001, David Wynter wrote:

> Hello,
> 
> I had a gotcha with my Turbine application (TDK 2.1, Oracle on W2K). If the
> user enters a value into a form to be stored in the database and leaves a
> trailing blank (space char) on the entry it gets stored like this in the
> database. When the user goes to select from a 'select' on the screen the
> value shown there has had the trailing blank stripped off (I don't know
> where yet) and as this is used to find the entry related to this name by
> using the value passed in as a part of a criteria 'add' it never finds it.
> 
> As far as I can see there are 2 solutions.
> 1. Preserve the trailing blanks all the way through.
> 2. Strip the blanks before storing the value in the database.
> 
> In my application I do not want the trialing blanks so I need to strip them.
> Next Q is where to do this, do I use Intake (which I have not used yet) or
> have a convenience method that walks through the arguments and strips white
> space from the end of each argument in a Parameter Parser object.
> 
> Suggestions on the best approach?
> 
> Regards
> 
> David
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 

-- 
brian lawler
branuity
617 front           | v: 415.217.5052
san francisco 94111 | m: 415.307.5277
brian@branuity.com  | f: 415.217.5060


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>