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
ericfickes on 360Flex: Stoked to get a break and hear great devs.:
Hey Brian, be sure to say hi at 360. Jun and I are pretty excited about th...
shiv on AS3: Creating custom events:
ThankU very much.This helped me a lot in understanding this concept....
connatser on Flash and FDT: Simple workflow video:
Thanks Lee, that's cool to here about the new features with FB4, Bridge...
Lee Probert on Flash and FDT: Simple workflow video:
you could use ANT to automate the publishing of the FLA.New FlashBu...
Wouter on Flex Framework: RobotLegs simple demo:
thanks for this! It helps to get started with RobotLegs. I started working ...