Flex: Composite Validator
This is a quick utility class I came up with that will keep track of a set of Validators and change a bindable property to true if all of the validators it tracks are valid and false if any of the validators is invalid.
I wanted this so I could quickly say something like:
<mx:Button label=”OK” enabled=”{compositeValidator.valid}” />
Here’s how to use it:
<validators:CompositeValidator id=”compositeValidator”>
<validators:validators>
<mx:StringValidator … />
<mx:EmailValidator … />
</validators:validators>
</validators:CompositeValidator>
<mx:Button …. enabled=”{compositeValidator.valid}” />
To get the source just right click on it and select “View Source …”