Masked input taglib ver. 1.2

    Custom JSP tags library. Custom tag maskedInput lets you add input mask for your HTML controls (e.g. allow numeric input only, SSN number etc.). For example this input field lets you type only integer value:

<%@ taglib uri="taglib.tld" prefix="m" %>

<!-- integer value -->
<input size="10" name="amount" value=""
<m:maskedInput mask="^[0-9]*$"/>

and you will get some like this:

Some useful masks are:

- integer value: ^[0-9]*$
- allows negative value: ^-?[0-9]*$
- allows $ sign: ^\\\$?[0-9]*$
- allows float values: ^[0-9]*\\.?[0-9]*$

so for example this input field allows numeric values only:

<input size="10" name="amount" value=""
<m:maskedInput mask="^-?[0-9]*\\.?[0-9]*$"/>

Tags are:


Supports masked input elements. Parameters are:

1) mask Provides a regular expression for your mask.
2) onKey Optional parameter. Possible values are true or false. If this value is true than tag will check input after the each typed symbol, otherwise it will be checked after the finishing. Default value is true.

For downloading:

 Library: maskedinput.jar     Description: taglib.tld

 © Coldbeans      Comments?

See also Coldtags suite - the largest collection of custom JSP tags.