ember-phone-input icon indicating copy to clipboard operation
ember-phone-input copied to clipboard

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

Open StanislauKashenou opened this issue 4 years ago • 2 comments

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

  • [x] Obvisously, add your option

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

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

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

StanislauKashenou avatar Sep 30 '20 07:09 StanislauKashenou

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 :)

dbendaou avatar Sep 30 '20 09:09 dbendaou

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!

StanislauKashenou avatar Sep 30 '20 13:09 StanislauKashenou