Jason,
Thanks. I guess I just got mixed up since it's a little unnatural to
instantiate a class to call a method that should be static! Also,
adding text to the "errorString" field automatically sets everything
red....here's my method should anyone search upon this message at a
future date:
private function validateField() : void {
var emails : Array = toField.text.split(",");
for(var j:uint=0; j < emails.length; j++)
{
var emailVal : EmailValidator = new EmailValidator();
var valResult : ValidationResultEvent =
emailVal.validate(emails[j]);
if(valResult.type == ValidationResultEvent.INVALID)
{
toField.errorString="'" + emails[j] + "' is not a valid
e-mail address.";
return;
}
}
}
--- In [EMAIL PROTECTED]ups.com,
"Jason Szeto" <[EMAIL PROTECTED]> wrote:
>
> Suzy,
>
>
>
> The listener, source and trigger are all optional properties
> of Validators. You can just call the validate() function. Pass in the
> string you want to validate and it will return the ValidationResult. The
> validate() function is on the base class, Validator.
>
>
>
> Jason
>
>
>
> ________________________________
>
> From: [EMAIL PROTECTED]ups.com
[mailto:[EMAIL PROTECTED]ups.com]
On
> Behalf Of Suzy Lawson
> Sent: Tuesday, June 27, 2006 10:54 AM
> To: [EMAIL PROTECTED]ups.com
> Subject: [flexcoders] Custom Validator woes....
>
>
>
> I'm building an e-mail client where the "To:" field can have a
comma
> delimited array of e-mail addresses: "[EMAIL PROTECTED]
> <mailto:bob%40yahoo.com> , [EMAIL PROTECTED] <mailto:sarah%40yahoo.com>
"
>
> I have the validation occuring in the focusOut event, where I split
> the "To:" field so I get an Array of e-mail addresses.
> var emails : Array = value.split(",");
>
> I then want to loop through and validate each value. However, there is
> no easy way to do this using the Flex SDK EmailValidator.as.
>
> Ideally, I would think I could call a static method which would return
> me a ValidationResultEvent, which I could then add to my component.
> However, everything with the SDK EmailValidator class requires a
> listener/source/trigger to be bound to it and no matter what I try to
> do....it looks at that "To:" field as one big String...I can't
give it
> just the iterated split value.
>
> Any ideas on this?? Is there a way to statically call a method without
> having to pass in a reference to the EmailValidator object?
>