Comments (5)
Can I ask why you want this?
Did you know that even if the user types their number in the national format (without the international dial code), you can always use getNumber
to get the full international number (including the international dial code)?
from intl-tel-input.
HI,
to add validation on the obligatory nature of having a prefix without having to use other tools afterwards, such as pop-ups or external alerts. Some of our users, when editing the telephone number, have the habit of removing the prefix with the result that the subsequent sending of a text message fails due to the lack of it.
By having an integrated validation check that requires the presence of the prefix, we standardize the input error reporting.
from intl-tel-input.
As per my previous message, you do not need to restrict the user in this way. You can allow the user to enter their number however they like, and you can always get the standardised international number using getNumber
. Closing for now, but let me know if you have any problems.
from intl-tel-input.
calling getNumber on this, doesn't return +41 12345678
Edit ----------
I just solved in this way:
input.onblur = function () {
if (input.value) {
const countryData = iti.getSelectedCountryData();
iti.setCountry(countryData.iso2);
const number = iti.getNumber();
input.value = number;
iti.setNumber(number);
var event = new Event('change');
input.dispatchEvent(event); // Notify Blazor about the change
}
}
from intl-tel-input.
calling getNumber on this, doesn't return +41 12345678
No because that's not a valid number. As per the readme, getNumber
only works with valid numbers so you need to use isValidNumber
to confirm the number is valid first. If it is valid, then you can use getNumber
to get the full international number.
from intl-tel-input.
Related Issues (20)
- Invalid country data for French overseas territories HOT 2
- Convert flags.png to AVIF format to comply with PageSpeed Insights recommendation HOT 5
- New Country to be added => Artsakh | 374 47, 374 97 HOT 2
- U.S. is not showing the u.s. flag HOT 10
- Dark Mode Support HOT 2
- Question about strictMode HOT 3
- Validation doesn't work for some phone numbers from Germany HOT 2
- utilsScript fails to load the utils from CDN in Next.js app HOT 13
- This input doesn't work on two elements HOT 3
- Getting error while using utilsScript HOT 6
- React component - allow access to intlTelInput instance HOT 14
- [Webpack] Compilation warning when initializing `intlTelInput` with `utilsScript` HOT 3
- Ukrainian mobile code 98 conflicts with Iran code HOT 1
- Selecting any country with Country code +1 and adding number, it resets the country to US. HOT 1
- Brazilian numer is formating national code without parenthesis HOT 1
- In Version 23.0.7 the intlTelInput.getCountryData() static function returns empty string value for name property. It was working fine till v20.3.0 HOT 3
- UK phone numbers wrong validation rules HOT 1
- Migrate tests to Jest
- isValidNumber doesn't works properly for Brazilian numbers HOT 3
- search field if one country? HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from intl-tel-input.