'LinKin Posted February 26, 2014 Share Posted February 26, 2014 Hello, I want to know how can I restrict the characters that a player can type inside an editBox ABCDEFGHIJKLMNOPQRSTUVWXYZ and 0123456789 How can I do that? Thanks Link to comment
myonlake Posted February 26, 2014 Share Posted February 26, 2014 There are many ways to do this, and one way is to use pregReplace in combination with guiGetText and guiSetText. You can trigger the function with the onClientGUIChanged event. Link to comment
'LinKin Posted February 26, 2014 Author Share Posted February 26, 2014 Still not clear for me I want just to allow users to type Alphanumeric characters [A-Z] [0-9] not characters like: #¬€|@ etc.. Link to comment
cheez3d Posted February 26, 2014 Share Posted February 26, 2014 You can use string functions. Link to comment
pa3ck Posted February 26, 2014 Share Posted February 26, 2014 If you don't want them to type letters or numbers use onClientKey and cancelEvent. Not sure now, if cancelEvent will cancel the event if you are typing, give it a try. Link to comment
'LinKin Posted February 26, 2014 Author Share Posted February 26, 2014 I want just to allow users to type Alphanumeric characters [A-Z] [0-9] not characters like: #¬€|@ etc.. Link to comment
cheez3d Posted February 26, 2014 Share Posted February 26, 2014 I extracted this from an old script i made. You might find it helpful. if string.find(guiGetText(source),"%W") then guiSetEnabled(NextStepchoosenameTXT,false) guiStaticImageLoadImage(NextStepchoosename,"pictures/button_disabled.png") guiSetText(errorOutput,"Your first name must not contain non-alphanumeric characters!") end http://www.lua.org/pil/20.2.html - patterns are explained here Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now