AS3 Open Source: Custom Form Validation
During a normal week I may write 2-3 form based applications in either Flash or Flex and each of them have specific form values that need validated. Last week I decided to begin to write a custom validator in Pure AS3 that I can reuse and simply pass it an array of information to validate against. The first iteration is a simple check against a value and a parameter of what would make it invalid, for example a String and if it == “”. The validation built into Flex is “ok”, but I needed some more portable, extensible and very reusable.
I have included a sample test instantiation for using the classes, simply checking for String values, but you can pass basically anything you like to the validator and it will check the value against the parameter that would make it invalid. I am sure this will change a lot over the next few weeks as I add validation types, values and such, so I will continue to commit the source to git. I am trying to keep it as generic as possible, to use in both Flash and Flex projects. Custom events are fired on pass and fail, passing along an array of information based on the fields that failed. You can then call your methods to submit the form or throw Alerts, etc…up to you.
I have posted the initial classes on my github account with an MIT Open Source license.
You can grab the early framework or fork the repository at github here > NumbKnuckle Validator

Recent Comments
kathryn on I have joined litl!:
psyched to have you onboard! this team just gets more and more awesome....
Filippo on My FlashBuilder 4 color scheme.:
Flash Builder is such a powerful tool, but syntax highlighting just sucks! ...
Devi on AS3: Creating custom events:
This example is awesome...
Josh Molina on AS3: Creating custom events:
Excellent tutorial. Straight and to the point.Thank you.Jo...
connatser on Flash Player 10.1: Verifiable speed increase.:
Thanks for the comment Jackson, your blog post was great inspiration....