ember-phone-input
ember-phone-input copied to clipboard
add 'allowAutoFormat' option to disable automatic transformation letters -> numbers
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}}
. Iffalse
- letters not transformed to numbers automatically. - Added demo docs and test.
Screenshots
Before:
input: +353 7890 test for both cases
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
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 :)
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!