How do I trim the contents of a form?
This piece of code will trim the contents of a form. Since the form scope always exists in ColdFusion, you can either run it automatically, or only when a form post is submitted.
<cfset form[formfield] = trim(form[formfield])>
</cfloop>
Another suggestion would be to htmlEditFormat the data. This escapes any HTML tags the user may have entered into the form:
<cfset form[formfield] = trim(htmlEditFormat(form[formfield]))>
</cfloop>
This question was written by Tjarko Rikkerink.
It was last updated on January 13, 2006 at 7:00:55 AM EST.
CFML Referenced
Categories
Comments
There are no comments for this entry.