cnpj-alphanumeric-mask
Reactive icon

CNPJ AlphaNumeric Mask

Stable version 1.0.0 (Compatible with OutSystems 11)
Uploaded
 on 31 Dec (19 hours ago)
 by 
0.0
 (0 ratings)
cnpj-alphanumeric-mask

CNPJ AlphaNumeric Mask

Details
Formatting and validation of CNPJ (Brazilian company tax ID), compatible with the traditional (numeric) CNPJ and the new alphanumeric CNPJ. Applies the mask __.___.___/____-__ in real time, correctly controls the cursor (including when using Backspace and Delete), and restricts typing according to the official rules of the Brazilian Federal Revenue Service. It also has a client action for CNPJ validation, allowing you to identify if the entered value is valid. During typing, it automatically provides: - Formatted CNPJ - CNPJ without mask (clean)
Read more

CNPJ Formatter and Validator (Numeric and Alphanumeric)

This component provides a complete solution for formatting, input control, and validation of the Brazilian CNPJ (Cadastro Nacional da Pessoa Jurídica), fully compatible with both the traditional numeric CNPJ and the new alphanumeric CNPJ model established by the Brazilian Federal Revenue Service.

The component applies the official CNPJ mask __.___.___/____-__ in real time, ensuring a consistent and user-friendly typing experience. Cursor positioning is intelligently managed, including advanced scenarios such as Backspace and Delete operations, text selection deletion, and cursor navigation through mask separators, preventing unexpected behavior during editing.

Input is strictly controlled according to official rules:

  • Only alphanumeric characters are allowed

  • The last two digits (check digits) are restricted to numeric values

  • Input length is limited to 14 logical characters, independent of the mask

The component also includes a client-side validation action that verifies the CNPJ using the official modulus 11 algorithm, supporting:

  • Numeric CNPJ (legacy model)

  • Alphanumeric CNPJ (base-36 calculation with letters A–Z)

This validation ensures that the entered value is structurally correct and mathematically valid before submission.

During user interaction, the component continuously exposes the following values through a client action:

  • Formatted CNPJ (with mask applied)

  • Clean CNPJ (without mask, containing only alphanumeric characters)

These outputs make it easy to integrate the component with business logic, persistence layers, and external services.

Designed specifically for OutSystems applications, the component is fully compatible with client-side JavaScript (ES5) and follows best practices for performance, usability, and maintainability, making it suitable for enterprise-grade applications and reusable UI libraries.

Release notes (1.0.0)
License (1.0.0)
Reviews (0)
Team
Other assets in this category