views:

74

answers:

1

I find myself writing code like this in ColdFusion a lot:

<cfset inputval = "" />
<cfif IsDefined("Form.Releases")>
    <cfset inputval = Form.Releases />
</cfif>

This is very cumbersome. I just want an undefined value to be converted to an empty string. Is there any kind of shortcut?

For example, in PHP I do this with strval function, i.e.:

$inputval = strval($_POST['Releases']);
+9  A: 

Check out cfparam

http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-b13.htm

<cfparam name="Form.Releases" default="">
<cfset inputval = Form.Releases />
RC
thanks, i forgot about cfparam.
Kip