How do I prevent unicode characters like, f.e. emojis from input in vue.js 3 + vuetify 3 + Codeigniter 4? I’m building admin panel, where I can add user accounts. There is no native mechanism to prevent putting emojis into user name.
I tried to find the answer everywhere, but all I get is some additional, cheesy js to prevent user from pasting into input,but All I want is just filter it after the data is sent to backend.
5
To prevent users from entering Unicode characters in input fields, you can use input event handling to filter out any non-ASCII characters. #vuejs3 #codeigniter
Dev Syd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Ok, I’ll go with custom Vuelidate rule:
const alphaNumSpace = helpers.regex(/^[a-żA-Ż0-9_ ]*$/)
...
alphaNumSpace:helpers.withMessage('Invalid characters', alphaNumSpace)