validatePin calls
PinCodeValidator.PinCodeValidate(validator,
value)?
How does your PinCodeValidate functionknow
about “pin” or about myField?
I’m guessing you probably just have
a typo in your code where you used PinCodeValidator instead of PinCodeValidate.
Matt
From: Ketan R Bengali
[mailto:[EMAIL PROTECTED]
Sent: Monday, February 21, 2005
4:31 AM
To: [email protected]
Subject: [flexcoders] Custom
Validator
I have made a custom validator (with an error).
The error message is:
"There is no method with the name
'PinCodeValidator'"
The .mxml file and the .as file exist in same
directory.
The .as code is as below:
class PinCodeValidator extends
mx.validators.Validator {
public static function
PinCodeValidate(validator:mx.validators.Validator):Boolean
{
if(pin.length == 0) {
validator.validationError("ValueRequired", "You are
required
to provide the Pincode", myField)
return false;
}
if(!isNaN(pin)) { // if pin is a number
validator.validationError("NotNumber", "Pincode should
consists only numbers", myField)
return false;
}
if(pin.length!=6) {
validator.validationError("wrongLength", "Pincode should
be 6
characters long", myField)
return false;
}
return true;
}
}
The .mxml file from which the validator is called
is a
component.
Code used for calling:
<mx:Validator field="vUD.mpin"
validate="validatePin(event.validator,
event.value);" />
Can anybody tell me where am I going wrong ?
Thanks
Ketan B