<cffunction name="generalSubmit" access="public" returntype="any" output="false">
<cfargument name="Event" type="any" />
<cfset event.setValue('some_field',trim(some_field))>
<cfset event.setValue('some_other_field',trim(some_other_field))>
<cfset var rc = event.getCollection() />
....etc
****************
using the event.setValue seems to work before calling getCollection()
.....
Is there a better way to do this?
("this" being trimming white space off form fields being submitted)
Any links to coldBox documentation of best practice are appreciated.
<cfset event.setValue('some_field',trim(some_field))>because you're relying on "scope hunting" to resolve some_field to url.some_field or form.some_field.
--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+unsubscribe@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/0050019a-e489-492f-9430-b33340fe5d2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<cfset event.setValue('some_field',trim(some_field))> does work - so I'll stick with that until I can get the suggestions to work.
(the code provided just throws a CF error)
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
Firstly, you need to call getCollection(), rc and prc and already passed into every handler action. Secondly, it wouldn't matter when you called it because it's a struct and it's passed by reference. Thirdly, don't use that code:<cfset event.setValue('some_field',trim(some_field))>because you're relying on "scope hunting" to resolve some_field to url.some_field or form.some_field.
Finally, if you simply want to trim values at the point of use, just do this:trim( rc.some_field )or thisrc.some_field.trim()or thisevent.getTrimValue( 'some_field' )
If you really want to just trim every single value, then just do this:rc.each( function( k, v ) {rc[ k ] = trim( v );} );
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
On Tuesday, May 8, 2018 at 11:46:32 AM UTC-7, Brad Wood wrote:
Firstly, you need to call getCollection(), rc and prc and already passed into every handler action. Secondly, it wouldn't matter when you called it because it's a struct and it's passed by reference. Thirdly, don't use that code:<cfset event.setValue('some_field',trim(some_field))>because you're relying on "scope hunting" to resolve some_field to url.some_field or form.some_field.
*maybe so, but it does work.
Finally, if you simply want to trim values at the point of use, just do this:trim( rc.some_field )or thisrc.some_field.trim()or thisevent.getTrimValue( 'some_field' )
* those all work fine for displaying data coming OUT of the RC.
I want to trim whitespace BETWEEN the FORM submission AND the RC, which is later used to update a DB.outside of coldBox I;'d normally just doDBfield = '#trim(form.fieldname)#'
If you really want to just trim every single value, then just do this:rc.each( function( k, v ) {rc[ k ] = trim( v );} );
* that code throws a CF error.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/0050019a-e489-492f-9430-b33340fe5d2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+unsubscribe@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/81a8ba08-af3d-432f-a42c-8a70ce9a0975%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+unsubscribe@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/a82779b1-2bc4-4b12-a875-e229e9927213%40googlegroups.com.