- Home /
Input field: How do I allow only alphanumerical characters and spaces?
I'd like some help with setting the allowed characters for an input field. By opening the debug window I've managed to change the "Content Type" and "Character Validation" for my input field to only allow numerical characters but it also has to allow spaces to be written and I haven't been able to find a setting for this. Is there a way to make input fields allow only alphanumerical characters and spaces?
What do you have so far. I usually do something like this in code.
@$$anonymous$$ittenSnipes Sorry, what do you mean what I have so far? If you mean in code I don't really have anything at all when it comes to which characters are allowed and which are not.
Answer by Cherno · Dec 18, 2017 at 12:27 PM
Remember to include the namespace System for this to work.
foreach (char c in Input.inputString) {
if (c >= '0' && c <= '9' || Char.IsWhiteSpace(c)) {
}
}
Your answer
Follow this Question
Related Questions
Allowing multiple dots in an input field on android 0 Answers
Reimporting fixed character FBX vert ordering explodes 2 Answers
models and animation where to start? 2 Answers
About keyframes,,, 0 Answers