I’m a severe requirement to restrict the input only to digits, Is there anyway to achieve this ?
Of course before posting to forum, I already tried googling but no luck,
Here is what I’m trying
<ion-input type='tel' pattern="\d*" class='phoneInput' >
it shows num pad but still it show some special characters like *
or #
here is the screenshot.
I don’t want to show either this special charaters or either language button.
Want something like similar, this is a whatsapp number input screenshot
Like in whatsapp no matter what your device language is, you are restricted to digits only, I want to achieve the same thing
Have you tried using inputmode
? You can do inputmode="numeric"
to only allow numbers.
1 Like
yes I tried, but it still showing some special characters
Can I see a screenshot of the keyboard?
@ldebeasi I’m sorry for my previous message, its not showing any special character
but it is still showing language change icon, is there anyway to prevent, because if user select Arabic, they can still type arabic numbers.
here is the screenshot
here is the screenshot
There is no way to prevent users from changing keyboards. This is by design on iOS.
but my friend, can you see in the screenshots above, in whatsapp number input field, we can’t change the language even
I don’t think that is something you can do in a webview.
If you are trying to ensure only numbers get submitted in your form then restricting the keyboard is not a good way to do this as users would still be able to copy and paste text they have in their clipboard. A better approach would be to do form validation or filter non-numbers as the user types.
2 Likes
Alright, thank you guys for helping, it was much needed