I am trying to check to see if data exist in my form If data does not exist I want to assign it to O. How can I do this.
Technically what you have is fine once you enclose the cfset
in tags <
and >
. Assuming that omission is just a typo, could it be you are trying to use it with a text field?
Text fields always exist on submission. The value may be an empty string, but the field itself still exists, so IsDefined
will always return true. If that is the case, you need to examine the field length or value instead. Then do something if it is empty according to your criteria. For example:
do something
... OR
do something
... OR