Field Nif, Nie or Cif
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`
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.
Activity
Release Timeline
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 1.2.0 | Stable | 9–11 | Adds smart NIF, NIE and CIF detection, canonical normalization, configurable allowed types, entity-level validation, and improved Webform integration. | Aug 14, 2026 | |
| 1.0.9 | Stable | 9–11 | Improves NIF/NIE/CIF configuration and validation across Drupal 9.4, 10, and 11 | Aug 13, 2026 | |
| 1.0.8 | Stable | 9–11 | Mar 11, 2025 | ||
| 1.0.7 | Stable | 9–11 | Feb 15, 2025 | ||
| 1.0.6 | Stable | 9–11 | Feb 15, 2025 | ||
| 1.0.5 | Stable | 9–11 | Drupal 11 Compatibility | Jan 30, 2025 | |
| 1.0.4 | Stable | 9–10 | Jan 14, 2025 |