Issue with Date validation from actionscript Flex 4

Posted by Tam on Stack Overflow See other posts from Stack Overflow or by Tam
Published on 2010-03-24T13:52:44Z Indexed on 2010/03/24 13:53 UTC
Read the original article Hit count: 845

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about flex