Alex left out the right double quotes. Since your function is a
property of your class like any global variable you can access it with:

if("validate" in myObject) {}

-or-

if(myObject["validate"])

-or-

if(myObject.hasOwnProperty("validate")) {}
--- In [email protected], "j_lentzz" <[EMAIL PROTECTED]> wrote:
>
> What is the syntax to do this?  Just using validate in myObject
> returns an error about validate being an undefined property.
> 
> John
> --- In [email protected], "Alex Harui" <aharui@> wrote:
> >
> > If ("validate in someObject)
> > 
> >  
> > 
> > ________________________________
> > 
> > From: [email protected]
[mailto:[EMAIL PROTECTED] On
> > Behalf Of j_lentzz
> > Sent: Tuesday, September 18, 2007 7:26 AM
> > To: [email protected]
> > Subject: [flexcoders] How to see if method is implemented in class
> > 
> >  
> > 
> > Hi,
> > 
> > I've got a problem I'm trying to resolve concerning validating a page
> > before submitting it to the server. I have a way to recursively get
> > each child on the page. However, I can't figure out a way to see if
> > the child has the validate() method implemented. Most of the
> > components are extended from TextInputs, ComboBox, etc, where I've
> > integrated a validator into each one that is custom for that type. So
> > my custom components will have a validate method, however, other
> > components - like Images, Buttons, etc - on the page don't have a
> > validate method. Is there a way to test that a method exists, before
> > trying to call it and causing an exception?
> > 
> > Thanks,
> > 
> > John
> >
>


Reply via email to