FormattedTextField (with MaskFormatter) on Javascript

While working on the Formspider framework (which has both Java and JavaScript renderers), we needed to implement a FormattedTextField component. It was easy to implement on Java side by using JFormattedTextField with a MaskFormatter. For JavaScript renderer we implemented a new MaskFormatter class as similar as possible to java.

Here is the source code that also includes an example:

In handlers.js, you can see event handlers for key inputs (including navigation keys), paste operation and validation on blur.

(###) ###-##-## mask is used in the example. Available masks are { # U L A ? * H }. See Java MaskFormatter page for more information.

Tested on IE8, FF3 and Chrome6.

Öskan Şavlı


Popular posts from this blog

How Does Oracle's Core RDBMS work?

Version Control for Oracle Database

Wrapping PL/SQL Source Code and a Strange Bug (PLS-00753)