Pergunta

I have a DateField with editable = true. Now i want to validate the DateField TextInput. If the user enter the value like this "200001/12/12", it has to be display the error message. How can i do it?

Foi útil?

Solução

If you are using your own date format, you need to make the validation by your own (custom function). Otherwise, you can use a DateValidator and call validate on DateField change:

<mx:DateValidator id="dateValidator" source="{myDate}" property="text" requiredFieldError="You must choose a date" />
<mx:DateField id="myDate" focusOut="dateValidator.validate()" />

This is a basic example, maybe you will need to tweak it a little. You can also use the reference (it has a working example at the bottom):

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/validators/DateValidator.html

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top