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
connatser on AS3 Playground: Simple Particles:
thanks Richard, and thanks for checking it out!...
connatser on AS3: Motion Blurring with Flash, part 1:
I agree, thanks. I will get some source files together and update the post....
Chris on AS3: Motion Blurring with Flash, part 1:
would be a lot easier to follow this tute for a beginner if you'd inclu...
rv on AS3 Playground: Simple Particles:
great example, nice job....
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...