Skip to content

[BUG] Strict mode validation length doesn't works when country code is in the field #1931

Open
@creador-dev

Description

@creador-dev

Plugin Version

v25.2.1

Steps to Reproduce

  1. Initialize the plugin with the following options:
    validationNumberTypes: null,
    strictMode: true,
  2. Add a phone number to the text field, including the country code (e.g., +1 12345678901234567890).
  3. Observe that the strict mode validation fails to enforce the number length.

Expected Behavior

Strict mode should validate the phone number properly, even when a country code is present in the field. The length and type of the number should adhere to the validationNumberTypes configuration.

Actual Behavior

When a country code is included in the field, the number length appears to be unlimited, and strict mode validation does not work as expected.

Initialization Options

The following options are used for initialization:

validationNumberTypes: null,
strictMode: true,

Additional Notes

  • It seems that the country code is not being correctly factored into the validation logic when strictMode is enabled.
  • The expected behavior should validate the full number, including the country code.

Proposed solution

After looking at the code I think we can get the number ignoring the country code and check if it's within the length and stop user from entering more number.
#1932

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions