vue-tel-input
vue-tel-input copied to clipboard
Vue3 beta.4 not validating mobile number
Hi, I came across an issue with the validation in the vue 3 version. The mobile number is not being validated when typing - I am able to enter letters and other characters. If you change the country it validates it though.
Not validated:
Change country then it is validated, invalid characters are removed and it is reformatted to the correct format:
My settings object which I declare in my main.js looks like this:
const vueTelInputOptions = { mode: "international", defaultCountry: "ZA", enabledCountryCode: true, preferredCountries: ["ZA", "NA"], validCharactersOnly: true, autocomplete: "off", dropdownOptions: { showDialCodeInList: true, showDialCodeInSelection: true, showFlags: true }, inputOptions: { placeholder: "Enter Mobile Number", required: false } };
@keziakoko I have the same issue, did you manage to fix it somehow? Something I noticed is, vue-tel-input works fine on firefox, on Chromium based browsers it has the same problem you described.
@emanuellopess I did not manage to fix it. I ended up adding in my own validation in an off focus event on the input. It appears to be working on my firefox as well, however I can still enter invalid characters, it does put it in the correct format with the correct prefix though.
Hoping to get a resolution on this...
Yes i am also experiencing the same. the library is not validating on typing , and it also accepts other characters