Sometimes you need the user to input data in a particular format like a Social Security Number or a standard US phone number. By masking input of a particular textbox, you can change its behavior so that it accepts input only according to specified format, e.g. a masked phone number input box will only allow 10 digits of of the phone number to pass through and won’t accept any other input.
Drupal 8 users:
Currently this module only works with Field type
Drupal 7 users:
This module includes:
- A fully configurable field widget
- A form element
- A small API for embedding this feature on existing form elements
- A user interface for configuring your own mask definitions
- Drush integration
- Drush make example file
You are free to use this module in the same fashion that is described for the Drupal 6 version, all you'll need to do is include the script from code using Libraries API
libraries_get_path('maskedinput') . '/jquery.maskedinput-1.3.js';
Drupal 6 users:
There is a simple configuration page that allows you to enter each field you want masked along with simple masking parameters.
Use the following format: $("#YOUR-FIELD-ID").mask("YOUR-MASK");
Where "YOUR-FIELD-ID" is the CSS ID of the textfield you want to mask and "YOUR-MASK" is one of the following
- a - Represents an alpha character (A-Z,a-z)
- 9 - Represents a numeric character (0-9)
- * - Represents an alphanumeric character (A-Z,a-z,0-9)
Optionally, if you are not satisfied with the underscore ("_") character as a placeholder, you may pass an optional argument to the maskedinput method.
- Maintenance status: Actively maintained
- Development status: Under active development
- Reported installs: 2,665 sites currently report using this module. View usage statistics.
- Downloads: 12,115
- Last modified: January 19, 2017
- Stable releases are covered by the security advisory policy.
Look for the shield icon below.