It is intended behavior that if you donot
change anything in an initially blank field the validator will not fire. The
reason we did this is that many times a user will tab through a field intending
to fill it in later, so we found it to be frustrating when the field
immediately turned red ("how can my value be invalid when I didn't
enter anything yet?"). Additionally, if you had an alert or some other obtrusive
mechanism to indicate that validation had failed it was even more frustrating
to the user. So we decided if they didn't actually change the value and
the value had not been set before, don't fire validation. Essentially
you have to get one real value (not null, not undefined, not empty string) before
binding and validation will start to fire.
Hope this clarifies things,
Matt
-----Original Message-----
From: Kai König
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 12, 2004 6:18
AM
To: Dirk Eismann
Subject: Re[2]: [flexcoders]Re:
Required validation doesn't work...
Hello Dirk and Susan,
in my case it even doesn't do anything. It doesn't
do any validation,
I left all to be validated fields empty and was
able to tab around the
field, sending the form etc.
Cheers
Kai
>> 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.
DE> sure. I was referring to the snippet on
bottom of page 582. I pasted it
DE> into a bare bone Application, code isas
follows:
DE> <?xml version="1.0"?>
DE> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns:local="*">>
DE>
DE> <!--
start code block from the docs -->
DE> <mx:Model
id="date">
DE>
<month>{monthInput.text}</month>
DE>
<day>{dayInput.text}</day>
DE>
<year>{yearInput.text}</year>
DE>
</mx:Model>
DE>
DE>
<mx:TextInput id="monthInput"/>
DE>
<mx:TextInput id="dayInput"/>
DE>
<mx:TextInput id="yearInput"/>
DE>
DE>
<mx:DateValidator field="date"/>
DE> <!-- end
code block from the docs -->
DE> </mx:Application>
DE> This is *not* working. The Validator
doesn't gets triggered after
DE> changing focus by tabbing, clicking etc. I
guess it is because the
DE> "field" attribute of the
DateValidator is set to the whole model "data"
DE> instead of a field of the model, e.g.
"data.month". The code is working
DE> if you do this e.g.
DE> <mx:DateValidator field="date.month"/>
DE> now the DateValidator gets triggered after
leaving the monthInput
DE> TextInput field.
DE> Another thing I want to mention here is the
following: validators only
DE> get triggered if you type at least one char
into them - you can delete
DE> this characer afterwards but you haveto
type once. If you leave them
DE> blank (that is: load the mxml, click into
the first TextInput so that it
DE> gets the focus, then change the focusby
tabbing) they do not get
DE> triggered. Is this the intended/expected
behavior?