The problem is that the validators won't fire until they've seen a valid 
(non-empty) value come across.  We explicitly made a decision that tabbing 
through an empty field would not cause an error, so binding doesn't trigger 
validation in this case.  What you can do is programmatically set the value 
temporarily to a non-null value and then set it back.  Maybe you could add a 
focusOut handler on yourself and basically check if the value is "", and if so 
set your value to be " " and then immediately back to ""?

Sorry, definitely a wacky solution for now.

Matt
-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Kai 
König
Sent: Wednesday, August 17, 2005 5:13 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Validation TextInput

Hi all,

I want a bunch of TextInputs within a form to be required and to
validate against a common mx:Validator. This works fine in general, but
the customer wants that the validation comes up even if someone just
sets the focus to the particular TextInput, doesn't type anything and
immediately removes the focus from that field.

An example would be to just use the tab key to speedo through the
whole form... But obviously, the validation shouldn't trigger before
that (so - not loading a form which is full of failed validations)

To fullfill another requirement (validation during typing) I
subclassed TextInput and made the change Event committing as Steven
and Allister explained in their book on pg. 189:

[ChangeEvent("change")]

So, my idea of triggering the validation for my particular issue
was to broadcast the focusOut event in the subclass as committing
as well:

[ChangeEvent("focusOut")]

But, it doesn't work out. What works is to add

focusOut="mx.validators.Validator.isValid(this,'mymodel.myfield')"

as an attribute to my subclassed MyTextInput. But that doesn't seem
to be the best way doing it as there might be a bunch of input fields,
isn't there a better solution?

Cheers
Kai





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12h7buku1/M=362131.6882499.7825260.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1124354286/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life 
- brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to