-
Notifications
You must be signed in to change notification settings - Fork 8
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
Update the value from outside #206
Comments
At this point you can't do this via the component, because the point was to sanitize and standardize the entered user input. |
Oh ok, well it making it disappear and appear again works, i set up a second placeholder input right behind so that there the user still sees an input during the unmount/remount of the input. I am making an autocomplete, when the user starts typing the number, I show under the input all the phone numbers that could match, if the user click on one, I fill the input with the number. You can close this if you don't plan on implementing it |
I'll investigate that, how possible to implement. |
If you pass in an id to the TelInput component like so:
Then you can grab the reference to the underlying input and set the value there like so:
This is my current workaround for changing the value of an already mounted svelte-tel-input component. The only downside for me is it doesn't format the value you set it to. Could you possible export the handleParsePhoneNumber function so we could bind to the TelInput component and call this whenever we need to programmatically set the value? |
Hey! Yep, that was my first thought too, just have to test it. I'll make a PR soon. |
I also would like to have this, for my use case is simple: So In the initial render I don't have the values and after some time the request is finished with the values. I'm using SPA mode. Why not is possible to just update the values, even when using |
Hey! |
Hey, thank you for the suggestion. I'm applying this to my project too. May God bless you in any way possible. |
Are you still planning on making handleParsePhoneNumber available as a component method? Thanks! |
Hey! The main reason for that PR is so late is the national number handling and parsing... |
Hello,
Is there away to update the value from the outside ?
I can reset it but I don't know how to change it to another value.
For now I unmount the component for 1ms and mount it again with a new default value.
Thanks
The text was updated successfully, but these errors were encountered: