Fun With errorString

If you've ever worked with forms/user input in Flex... you've probably found yourself scratching your head once or twice with edge-case input validation.

Complex form validation can be done quickly and relatively painlessly... by managing a controls errorString property. The example is straight forward. Input some text into the box and click on the set errorString button. The image control above (with a mouse over) gives you a validation bubble.

An Image control has validation... you say? Not really, but with a little help from errorString you can make any control or container for that matter play a role in input validation that maintains parity with the base implementation.

The rule is essentially this:

if ( errorString == "" )
    no callout is displayed
else
    a callout id displayed with the errorString value 

You'll need to manage the validation mechanisms that wrap your complex implementation... but you expected that anyway right?

[ example: Error String ]
[ source: Error String ]