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

add 'allowAutoFormat' option to disable automatic transformation letters -> numbers #269

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

StanislauKashenou
Copy link

Description

Bug description: letters transformed to numbers on user input (trying to fit to valid phone number) - this behaviour was pretty confusing and we hadn't any options to turn-off this transformation.

Solution:
With @allowAutoFormat={{false}} option we can disable transformation, so user input remains unchanged.
Default value is true

Changes

  • new option added @allowAutoFormat={{false}}. If false - letters not transformed to numbers automatically.
  • Added demo docs and test.

Screenshots

Before:

input: +353 7890 test for both cases

image

Reproduction instructions

Checklist

  • Obvisously, add your option

  • Do not forget to write inline documentation for your code in addon/components/phone-input

  • Add a test, probably in tests/integration/components/phone-input-test.js

  • Add a playground example in tests/dummy/app/pods/docs/components/phone-input/all-options/template

@dbendaou
Copy link
Member

dbendaou commented Sep 30, 2020

Hey @StanislauKashenou, thanks for your contribution :)

However, I'm not sure to understand what's the use case here? Can you give more details?
Also, with this, will you want to send the value as it (ie with letter) to backend?
Thanks :)

@StanislauKashenou
Copy link
Author

Hey @StanislauKashenou, thanks for your contribution :)

However, I'm not sure to understand what's the use case here? Can you give more details?
Also, with this, will you want to send the value as it (ie with letter) to backend?
Thanks :)

Thanks for your work @dbendaou ! And for checking this one too! :)
Case here is to avoid letters-to-numbers transformation since it can confuse user and also it can lead to incorrect phone number data (in case if the conversion happens unnoticed by the user)

Sending value as it is ok
Since we can have validation on BE side
So instead of confusing transformation and saving potentially wrong number user will got according error message

thanks!

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 this pull request may close these issues.

2 participants