One fancy way to provide a bit of extra usability sugar on a form is to have formatting automatically applied to a textfield as the user types. I’ve been using a fantastic Mask Formatter javascript library created by PengoWorks for some time now on a number of production sites. This javascript can be configured different ways to constrain the user’s input to only certain characters, validate date format, etc. Check out the documentation on the PengoWorks site for ways it can be configured.
I’m uploading a slightly tweaked copy here since the version on that site hasn’t seen any changes in quite a while. I’ve made some minor bug fixes to it, but unfortunately I didn’t document exactly what I’ve changed. Primarily, I’ve focused on cleaning up the date format implementation.
One day I’d like to rewrite the logic here and make use of all of the enhancements in the prototype.js library. This one’s nice though, in that it doesn’t have any dependancies.
It goes without saying that this should not be used as a replacement for server-side validation of user input; it’s simple to bypass javascript validation of this sort by disabling javascript in your browser.
Flash 6 Actionscript Version:
I also wrote an implementation of textbox input masks for Flash 6. I haven’t tested or worked with this in newer versions of Flash, so I don’t know if it is still applicable. It was basically an actionscript 1.0 port/rewrite of the input mask class in the Java Swing framework. Hopefully this can be a starting point for using in your own Flash-based application:



Nice job. This works great for date input especially. Thank you for sharing.