chapter31

development in a land far far away…

at the moment

History is not what happened. History is what was written down.

Archive for April, 2006

Dumping and aborting with <cfscript>

Friday, April 28th, 2006

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

[…]

Read the rest of this entry »

isValid()

Thursday, April 20th, 2006

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

[…]

Read the rest of this entry »

cfdump goodies

Tuesday, April 11th, 2006

<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 […]

Read the rest of this entry »

How do I trim the contents of a form?

Saturday, April 1st, 2006

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 […]

Read the rest of this entry »