Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Brazilian IDs

226 sites Security covered Drupal 10–11
View on drupal.org

This module adds validation and formatting for Brazilian CPF (individual tax ID) and CNPJ (company tax ID) numbers. It provides widgets for text fields and new field types for use in forms, ensuring that Brazilian tax registration numbers are entered and displayed correctly.

Formerly called Brazilian Ids.

This module adds CPF and CNPJ validation functionalities for CCK fields.

CPF and CNPJ are tax registration numbers granted to individuals (CPF) and companies (CNPJ) by the Brazilian ministry of revenue.

Learn more about them at wikipedia, CPF and CNPJ

Drupal 6

Coloque campos de CPF e CNPJ tanto no perfil de seus visitantes como em qualquer conteúdo usando o CCK. Ele valida os números e ainda formata.

Drupal 7

It adds 3 new widgets to the text field type at the Field UI.

They are:
CPF - Accepts only valid tax number of individuals
CNPJ - Accepts only valid tax number of companies
CPF / CNPJ - Accepts either one as long as it is a valid number

The view format display are done as followed:
CPF - 000.000.000-00
CNPJ - 00.000.000/0000-00

It also adds 3 new field types for the Form API.
They are:
number_cpf, number_cnpj and number_cnpj_cpf

So, developers can easily build form elements of Brazilian Tax Number types. For example:

  $form['my_cpf_field'] = array(
    '#type' => 'number_cpf',
    '#title' => t('CPF'),
  );
  $form['my_cnpj_field'] = array(
    '#type' => 'number_cnpj',
    '#title' => t('CNPJ'),
  );
  $form['my_cnpj_cpf_field'] = array(
    '#type' => 'number_cnpj_cpf',
    '#title' => t('CNPJ or CPF'),
  );

And that's it! You are done.

The field value is saved into the database without the separators ( . - / ). Take a look at br_tax_number_fields_field_formatter_view() function for figuring out how to attach a field display to your entity.

Here is an example on how to display the field value with their separators:

$display = array('type' => 'number_cnpj_cpf');
$items = array(
  array('value' => $value)
);
$cpf_cnpj_field_view = br_tax_number_fields_field_formatter_view('', '', '', '', '', $items, $display);

Drupal 6 Maintained by

Wanderson S. Reis

Drupal 7 Maintained by

Francisco Luz

Drupal 8 Maintained by

Daniel C. Biscalchin
Bruno Magalhães

Drupal 10 and 11 Maintained by

Bruno Magalhães

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
3
Tracked since
Dec 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 3
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
2.0.1 Stable 10–11 May 22, 2025
2.0.0 Stable 8–10 Dec 4, 2024
2.0.x-dev Dev 10–11 Dec 4, 2024