Drupal is a registered trademark of Dries Buytaert
Release: Drupal 10.3.6 Update released for Drupal core (10.3.6)! Release: Drupal 11.0.5 Update released for Drupal core (11.0.5)! Release: Drupal 10.2.9 Update released for Drupal core (10.2.9)! Release: Drupal 10.2.10 Update released for Drupal core (10.2.10)! Release: Drupal 10.3.7 Update released for Drupal core (10.3.7)! Release: Drupal 11.0.6 Update released for Drupal core (11.0.6)! Release: Drupal 10.3.8 Update released for Drupal core (10.3.8)! Release: Drupal 11.0.7 Update released for Drupal core (11.0.7)! Module Revived: Translation Management Tool 8.x-1.19 Module tmgmt updated after 7 months of inactivity (8.x-1.19). Usage Milestone: Account field split Module account_field_split crossed 10,000 active installs.

This module uses the jQuery Mask Plugin to enable adding masks to input fields. By masking the user input, the provided values are restricted to only the allowed formats. Examples of data that should be masked include phone numbers, ZIP codes and IP addresses.

This module offers:

  • Field widget settings to add masks to fields. Several Drupal's widget types are supported out-of-the-box. Others can be easily added by third-party modules - by providing a my_module.mask_widget_types.yml file.
  • A Form API property ("#mask") to enable masking form elements in custom forms. The supported form elements include "textfield" and "tel". More can be easily added by third-party modules - with the help of the Drupal\mask\Helper\ElementHelper class.

Basic usage

After enabling the module at admin/modules, go to your content type's Manage form display page, e.g. admin/structure/types/manage/article/form-display. Click the gear icon of the fields that are using supported field widgets to change mask settings.

Currently, the supported field widgets are:

  • Textfield
  • Telephone

Please refer to the module's documentation for more detailed information.

Differences from the Masked Input module

The Masked Input module also provides means to mask Drupal fields. However, there are main differences from the Mask Field module that should be pointed out:

  • The Masked Input module provides a field widget to be used with some of the Drupal's built-in field types. On the other hand, the Mask Field module provides additional settings for existing field widgets.
  • The Mask Field module works with the Drupal's Telephone field type out-of-the-box.
  • The Mask Field module provides a Form API element to mask fields in custom forms using the "#mask" property.
  • The Mask Field module provides an extensible mechanism based on Drupal's Plugin API to allow third-party modules to integrate their own field types with it.
  • The Masked Input module uses the Masked Input plugin by Josh Bush whilst the Mask Field module uses the jQuery Mask Plugin by Igor Escobar.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Dec 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 2
Maintenance
Dormant

Releases

Version Type Core Release date
2.1.0-rc1 Pre-release Dec 3, 2024
2.1.x-dev Dev Dec 3, 2024