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

Is it possible to pre fill the textfield? #27

Closed
gabrielcandiag opened this issue Jun 21, 2018 · 4 comments
Closed

Is it possible to pre fill the textfield? #27

gabrielcandiag opened this issue Jun 21, 2018 · 4 comments
Labels
bug Done enhancement FAQ This is a questions that can be asked again and better be in FAQ

Comments

@gabrielcandiag
Copy link

I'm trying to pre fill the text field with the current phone number of the user, but the flag is not getting updated and also it's taking the code of US "+1" when the number is "569812312322" that is a Chilean number.

I'm using textfield.text = "569812312322" to pre fill the text field.

What happened?

Flag not getting updated and also wrong country code.

What did you expect to happen?

Set the flag to Chile and keep the correct code "56".

@NikKovIos
Copy link
Owner

You can do it with next code:

bottomTextField.customPhoneFormats = ["RU" : "# ### #########"]
bottomTextField.country = Country(countryCode: "ru", phoneExtension: "7", formatPattern: "# ### ########")
bottomTextField.text = "r34234234423422"

Try and tell if it works.

@NikKovIos
Copy link
Owner

NikKovIos commented Mar 8, 2019

Also check master branch, commit 011f709
I've implemented the prefill feature.

let source = NKVSource(countryCode: "ru")
bottomTextField.setCurrentCountryInitially = false
bottomTextField.preFillText(source: source, number: 7999432423)

or

let source = NKVSource(countryCode: "ax)
bottomTextField.setCurrentCountryInitially = false
bottomTextField.preFillText(source: source, number: 3586346363)

@NikKovIos NikKovIos added Done FAQ This is a questions that can be asked again and better be in FAQ labels Mar 8, 2019
@NupendraVerma
Copy link

if I get mobile number like "+91" "XXXXXXXXXX" from json country code and mobile number saprated then how to set into text field ?

@NikKovIos
Copy link
Owner

Closed due no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Done enhancement FAQ This is a questions that can be asked again and better be in FAQ
Projects
None yet
Development

No branches or pull requests

3 participants