| Contents > Developing ColdFusion MX Applications > Using ColdFusion Variables > Ensuring variable existence |
|
|
|
|
||
ColdFusion generates an error if you try to use a variable value that does not exist. Therefore, before you use any variable whose value is assigned dynamically, you must ensure that a variable value exists. For example, if your application has a form, it must use some combination of requiring users to submit data in fields, providing default values for fields, and checking for the existence of field variable values before they are used.
There are several ways to ensure that a variable exists before you use it, including:
IsDefined function to test for the variable's existence.cfparam tag to test for a variable and set it to a default value if it does not exist.cfform input tag with a hidden attribute to tell ColdFusion to display a helpful message to any user who does not enter data in a required field. For more information on this technique, see Requiring users to enter values in form fields.|
|
||
| Contents > Developing ColdFusion MX Applications > Using ColdFusion Variables > Ensuring variable existence |
|
|
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6.1
Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.