March 5, 2007

Input mask revisit

I stumbled across this very nice script by Xaprb that creates input mask for form fields. It’s a brilliant idea to auto fill some of the indentations, especially in date and time input fields for the users. I rewrote some of the codes to fix a couple issues:

Usability:
While I think the general good practice in preventing users from making mistakes when using an application is to not give users the chance to commit them at all in the first place, preventing impermissible input value from appearing at all is kinda obstructive and frustrating at times, especially from a user stand point. I modify it to display an error message instead.

I’d also added a default value to the fields to help guide the users.

Prototype library dependencies:
This is just a small rewrite. I replace the prototype functions with native and small, additional function to eliminate the library dependence. You do need a getClass and event handler function. I used getElementsByClassName by Robert Nyman and John Resig’s addevent.

You can browse the source here.

Related posts

Archives/related

© 2008 Wonderful dreams demand a beautiful mind.