I'm trying to validate whether or not an array element has been created.
Here is what one of the arrays could look like:
commentid[1] = undefined
commentid[2] = undefined
commentid[3] = 1
commentid[4] = 1
commentid[5] = undefined
commentid[6] = 1
I want to check if a certain array element is set to 1, but I'm getting errors in the code below because commentID[1] is undefined. How can I have the code not evaluate if it's undefined. I've tried using isDefined() and isValid() as well.
[code=cfm]
<cfoutput query="getComme nts">
<cfif #commentList[commentID]# eq 1>
Valid!!!!
<cfelse>
not valid!!!
</cfif>
</cfoutput>
[/code]
Here is what one of the arrays could look like:
commentid[1] = undefined
commentid[2] = undefined
commentid[3] = 1
commentid[4] = 1
commentid[5] = undefined
commentid[6] = 1
I want to check if a certain array element is set to 1, but I'm getting errors in the code below because commentID[1] is undefined. How can I have the code not evaluate if it's undefined. I've tried using isDefined() and isValid() as well.
[code=cfm]
<cfoutput query="getComme nts">
<cfif #commentList[commentID]# eq 1>
Valid!!!!
<cfelse>
not valid!!!
</cfif>
</cfoutput>
[/code]
Comment