IsDefined()
Evaluates a string value to determine whether the variable named in it exists.
For better performance and security, it's recommended to use StructKeyExists() instead
Status:
IsDefined( value=string );
Returns: Boolean
| Argument | Description |
|---|---|
|
value
string,
required
|
edit
String, enclosed in quotation marks. Name of variable to test for. Alias: variable |
Examples
edit//using isDefined with condition statement
if(isDefined("form.reset")){
//Code to be Executed
}
str={};
str.value="test";
writeDump(isDefined("str.value"));//true
Related System Properties / Environment Variables
- LUCEE_ISDEFINED_LIMIT - Alias for lucee.security.limitEvaluation, limits variable evaluation in isDefined
Type: boolean - LUCEE_SECURITY_ISDEFINED - Alias for lucee.security.limitEvaluation, limits variable evaluation in isDefined and related functions
Type: boolean - LUCEE_SECURITY_LIMITEVALUATION - Disable evaluating expressions when accessing scopes, Lucee 7 defaults to enabling this setting for security reasons. A boolean value. If enabled, limits variable evaluation in functions/tags. If enabled, you cannot use expressions within [ ] like this: susi[getVariableName()]. This affects the following functions: IsDefined, structGet, structSort (when using pathToSubElement), empty and the following tags: savecontent attribute `variable`
Type: boolean, Default: false (Lucee 6), true (Lucee 7)
See also
- Decision logic
- IsNull()
- StructKeyExists()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)