CFPARAM checks for the existence of a variable and sets a default value
(provided you have set the default attribute) if the variable does not
exist. Since your form fields all exist (they have an empty string for a
value), the default value is not getting set.

What you want to do is check the content of the form field. In the following
example, I trim the white space off the form field variable and return the
length of the remaining value. As you probably know, "0" is false and any
other number is true. So, if the value is "not 0" (i.e. not false), then set
the default value "N/A."

<cfif not Len(Trim(Service))>
        <cfset Service = "N/A">
</cfif>

Perhaps an easier to read example would be the following:

<cfif Trim(Service) is "">
        <cfset Service = "N/A">
</cfif>

On another note, CFPARAM works well with checkboxes, which do not pass empty
strings when not checked. They either exist or they do not.

Benjamin S. Rogers
Web Developer, c4.net
Voice: (508) 240-0051
Fax: (508) 240-0057


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to