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`
Project information
- Project categories: Content display, E-commerce
72 sites report using this module
- Created by alexjluna on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Adds smart NIF, NIE and CIF detection, canonical normalization, configurable allowed types, entity-level validation, and improved Webform integration.



