Monthly Archives: April 2006

April 28, 2006
Dumping and aborting with <cfscript>

One of the annoying things about cfscript is it’s lack of support for a lot of CFML tags.
<cfdump> and <cfabort> are 2 tags I always use in development, especially for debugging. A way to use this functionality is to create a UDF to do these types of functions.
For example
<cffunction name="dump" access="public" output="true" returntype="struct">
[...]

April 20, 2006
isValid()

New to ColdFusion MX7 the isValid() function tests whether a value meets a validation or data type rule and returns True if the value conforms to the rule; False, otherwise.
Function syntax
isValid(type, value)
isValid(“range”, value, min, max)
isValid(“regex” or “regular_expression”, value, pattern)

Example:

Valid integer!

Invalid Integer!

Value is between 1 and 100

[...]

April 11, 2006
cfdump goodies

<cfdump> is a fantastic debugging tool which can be used to display the values/results of simple and complex variables. But there are a couple of little known attributes you can take advantage of to make your life just peachy, namely:

expand
top

Expand is great when you’re working with large data structures which might take a long time [...]

April 1, 2006
How do I trim the contents of a form?

From ColdFusion Cookbook:
Trimming is an essential part of dealing with an data coming from form textfields or textareas etc. You can of couse trim as and when you need (before validation or database inserts etc) but if you can trim all fields quickly and easily!

This basically loops over a form structure [...]