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








Reply via email to