Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
creador-dev opened this issue Jan 15, 2025 · 0 comments · May be fixed by #1932
Open

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

creador-dev opened this issue Jan 15, 2025 · 0 comments · May be fixed by #1932

Comments

@creador-dev
Copy link

creador-dev commented Jan 15, 2025

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

@creador-dev creador-dev changed the title [BUG] Strict Mode Doesn't Work When Country Code is in the Field [BUG] Strict mode validation length doesn't works when country code is in the field Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant