Issue with Date validation from actionscript Flex 4
- by Tam
I have a DateValidator as follows:
<mx:DateValidator id="stringDateValidator"
property="text"
required="true"
inputFormat="dd-mm-yyyy"
allowedFormatChars="*#~/-" />
I would like to call the validator manually from actionscript:
var valErrEvent:ValidationResultEvent = stringDateValidator.validate(wholeDate);
if(valErrEvent.results.length > 0){
......
But I'm getting the following exception:
ReferenceError: Error #1069: Property month not found on spark.components.TextInput and there is no default value.
at mx.validators::DateValidator$/validateDate()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\validators\DateValidator.as:203]
at mx.validators::DateValidator/doValidation()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\validators\DateValidator.as:1404]
at mx.validators::Validator/processValidation()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\validators\Validator.as:1012]
at mx.validators::Validator/validate()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\validators\Validator.as:945]
if I let the validator triggers automatically it works.
You know how I can make that work? or do you have better ideas for validating dates using ActionScript instead of using the MX Validator.