On Sat, Sep 15, 2001 at 09:50:07PM -0700, RICARDO SANOJA wrote:
> Does anyone know how to validate an array element to see if exists.
> This is what I am trying to do.  I get an error.
> 
> <cfif isDefined("newWiz.deadlines[1]")>#newWiz.deadlines[1]#</cfif>
> 
> The error:
> Parameter 1 of function IsDefined which is now "newWiz.deadlines[1]" must be
> a syntactically valid variable name
> 
> 
> The error occurred while processing an element with a general identifier of
> (CFIF), occupying document position (78:4) to (78:42) 
> 
> 
> 
> Sincerely,
> Ricardo Sanoja
Ricardo,

Let me give this a try.  It'll have to be done in a couple of seperate
steps.

<cfscript>
if (isDefined("newWiz.deadlines") and isArray(newWiz.deadlines)) {
// here's the tricky part. CF doesn't force the programmer to insert
// elements into any order. So, that's on you.
  if ( ArrayLen(newWiz.deadlines)) {
    /* 
       all your code that depends upon elements of the array go here 
    */
  }
}
</cfscript>


Obviously some tweaking will have to be done in order to fit your 
circumstance, but something like this should fit your needs.
-- 
Josh Meekhof

-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

Reply via email to