Jacob,

Here is a version of this type of function:

<cffunction name="UnescapeFormValues" access="public" returntype="boolean"
output="no"
        hint="This unescapes form values for use within the database.">
        
        <!--- Define arguments. --->
        <cfargument name="Form" type="struct" required="yes" />
        
        <cfscript>
                
                // Define the local scope.
                var LOCAL = StructNew();
                
                // To unescape, really all we need to do at the moment is
put back in the
                // quotes so that the input values of form elements don't
break the page.
                // Loop over form object and clean all values.
                for (LOCAL.Key in FORM){
                        
                        // Trim the field value.
                        ARGUMENTS.Form[ LOCAL.Key ] = Trim(ARGUMENTS.Form[
LOCAL.Key ]);
                        
                        // Since we want to store regular quotes in the
database, lets make 
                        // sure we don't have any escaped quotes in the
submitted values. 
                        ARGUMENTS.Form[ LOCAL.Key ] =
Replace(ARGUMENTS.Form[ LOCAL.Key ], "&quot;", Chr(34), "ALL");
                        
                        // We don't want to store lame-ass Micorosoft
characters since they 
                        // never display correctly on the screen
cross-browser. Replace the 
                        // special characters that Microsoft uses.
                        ARGUMENTS.Form[ LOCAL.Key ] =
Replace(ARGUMENTS.Form[ LOCAL.Key ], Chr(8217), Chr(39), "ALL");
                        ARGUMENTS.Form[ LOCAL.Key ] =
Replace(ARGUMENTS.Form[ LOCAL.Key ], Chr(8216), Chr(39), "ALL");
                        ARGUMENTS.Form[ LOCAL.Key ] =
Replace(ARGUMENTS.Form[ LOCAL.Key ], Chr(8220), Chr(34), "ALL");
                        ARGUMENTS.Form[ LOCAL.Key ] =
Replace(ARGUMENTS.Form[ LOCAL.Key ], Chr(8221), Chr(34), "ALL");
                        ARGUMENTS.Form[ LOCAL.Key ] =
Replace(ARGUMENTS.Form[ LOCAL.Key ], Chr(8211), "-", "ALL");
                        ARGUMENTS.Form[ LOCAL.Key ] =
Replace(ARGUMENTS.Form[ LOCAL.Key ], Chr(8212), "-", "ALL");
                        
                }
                
                // Return out.
                return(true);
                
        </cfscript>             
</cffunction> 


As you can see, it trims all values in the form, and replaces out certain
values that I didn't want, like extended ascii values.

.......................
Ben Nadel 
www.bennadel.com

-----Original Message-----
From: Munson, Jacob [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 01, 2006 4:21 PM
To: CF-Talk
Subject: RE: Problems with LEN

> Is there someway to add a function to the CF system so that it is 
> automatically available to all templates as the built in functions 
> are?  Is there a directory of functions or something similar to CF 
> tags/custom tags?

That would be very nice...I'm waiting to hear if anybody knows how to do
this. 


---------------

This transmission may contain information that is privileged, confidential
and/or exempt from disclosure under applicable law. If you are not the
intended recipient, you are hereby notified that any disclosure, copying,
distribution, or use of the information contained herein (including any
reliance thereon) is STRICTLY PROHIBITED. If you received this transmission
in error, please immediately contact the sender and destroy the material in
its entirety, whether in electronic or hard copy format. Thank you. A1.





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241972
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to