Created
November 24, 2017 13:54
-
-
Save bcswartz/bb967e641f4cb315cf3b2943f7c71ba2 to your computer and use it in GitHub Desktop.
A method for performing processing on form field values defined in a list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction name="collectFormDataAndTrim" access="public" returntype="void" output="false" hint="I collect the form values"> | |
<cfargument name="event" type="any"> | |
<cfset var loc= StructNew()> | |
<cfset loc.propertyList= arguments.event.getArgument("propertyList","")> | |
<cfif loc.propertyList EQ ""> | |
<cfset loc.propertyList= arguments.event.getValue("fieldnames")> | |
</cfif> | |
<cfset loc.form= StructNew()> | |
<cfloop index="loc.prop" list="#loc.propertyList#" delimiters=","> | |
<cfset loc.propValue= arguments.event.getValue(loc.prop)> | |
<cfif IsNumeric(loc.propValue)> | |
<cfset loc.form[loc.prop]= loc.propValue> | |
<cfelse> | |
<cfset loc.form[loc.prop]= Trim(HTMLEditFormat(beans.miscService.removeMSWordChars(loc.propValue)))> | |
</cfif> | |
</cfloop> | |
<cfset arguments.event.setValue("form",loc.form)> | |
</cffunction> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment