I would put the trimming inside your setFoo method on your model object
instead, that way regardless of where its coming from, it will always get
trimmed.

ie:  Rather than call user.setName( trim( form.name ) ),  just call
user.setName( form.name ), then within the setName method, trim it before it
gets set internally, or before it gets persisted to your database.

Chris Peterson


On 8/9/10 3:17 PM, "[email protected]" <[email protected]> wrote:

> I've been building MG apps for the last year or two and really love
> the framework. But there's a nagging question that has always bugged
> me, form field trimming (to remove white space). Currently, when I
> process a form submission, I create a new object (let's take a product
> order as an example) and individually call the the setter methods,
> passing in the trimmed form value like this: <cfset
> ProductOrder.setProductName(trim(arguments.event.getValue("productName"))) /
>> .
> 
> This works great, but can be quite tedious if I have a form with a lot
> of values. Last night I discovered the MakeEventBean method (only took
> me 2 years to find it) and thought that this would be perfect for
> speeding up my development process. However, after digging through the
> source code, I realize that it is not trimming the values. Does anyone
> have a good way that they handle this type of situation? Where are you
> trimming your values?
> 
> Thanks for any insight.
> 
> Dean


-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

Reply via email to