Hi Susan,

> Can you point me to which snippet of code doesn't work? I 
> tried the code on pg. 582 of devflexapps.pdf and it works for me.

sure. I was referring to the snippet on bottom of page 582. I pasted it
into a bare bone Application, code is as follows:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
xmlns:local="*">
        
<!-- start code block from the docs -->
<mx:Model id="date"> 
<month>{monthInput.text}</month>
<day>{dayInput.text}</day>
<year>{yearInput.text}</year>
</mx:Model>
        
<mx:TextInput id="monthInput"/>
<mx:TextInput id="dayInput"/>
<mx:TextInput id="yearInput"/>
        
<mx:DateValidator field="date"/>
<!-- end code block from the docs -->

</mx:Application>

This is *not* working. The Validator doesn't gets triggered after
changing focus by tabbing, clicking etc. I guess it is because the
"field" attribute of the DateValidator is set to the whole model "data"
instead of a field of the model, e.g. "data.month". The code is working
if you do this e.g.

<mx:DateValidator field="date.month"/>

now the DateValidator gets triggered after leaving the monthInput
TextInput field.

Another thing I want to mention here is the following: validators only
get triggered if you type at least one char into them - you can delete
this characer afterwards but you have to type once. If you leave them
blank (that is: load the mxml, click into the first TextInput so that it
gets the focus, then change the focus by tabbing) they do not get
triggered. Is this the intended/expected behavior?

Thanks,
Dirk.


Reply via email to