This module validates Spanish NIF, NIE, and CIF numbers entered by users, ensuring the correct format and validity of the numbers and their corresponding check digits. It can be added as a field to content types and integrates with the Webform module to ensure only valid data is submitted.
The Spain NIF, NIE and CIF Field module provides a Drupal field type for entering and validating Spanish NIF, NIE, and CIF identification numbers.
The module validates each identifier's format and control character. It does not verify whether an identifier has been officially issued or belongs to a specific person or organization.
Features
- Supports Spanish NIF, NIE, and CIF identification numbers.
- Can be added to content types and other fieldable entity bundles.
- Lets site builders choose which identification types editors may enter.
- Provides an optional smart mode that detects the identification type
automatically from a single input.
- Accepts lowercase input and common visual separators such as spaces, dots,
and hyphens.
- Stores values in canonical uppercase format without visual separators.
- Provides accessible live feedback when a type is detected or a value is
invalid.
- Validates field values through Drupal's Validation API, including
entity-aware forms and integrations.
- Keeps manual type selection as the default for backward compatibility.
Webform integration
Enable the optional `field_nif_nie_cif_webform` submodule to add a NIF/NIE/CIF element to Webform.
The Webform element automatically detects NIF, NIE, or CIF values, validates their control character, and stores them in canonical format.
Requirements
- Drupal 9.4, 10, or 11.
- PHP 8.1 or later.
- Drupal Field module.
- Webform is required only for the optional Webform integration.
Installation
Install the module using Composer:
`composer require drupal/field_nif_nie_cif`
Enable the optional Webform integration with:
`drush en field_nif_nie_cif_webform`
Ask your assistant about Field Nif, Nie or Cif
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
- field Drupal core
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.