networkthis Posted May 11, 2008 Share Posted May 11, 2008 I have the following to allow only certain characters in a form field, it is for a text input box. It works great unless you hit enter to add a new line. How would I make this register hitting enter as well - I thought it was /n but I tried that and it did not work. function Validate_Message_Characters($message){ if (preg_match("/[^a-zA-Z.!,'0-9[:blank:]]/",$message)) { return false; } else { return true; } } thanks in advance for your help! Quote Link to comment Share on other sites More sharing options...
networkthis Posted May 11, 2008 Author Share Posted May 11, 2008 Ok I figured it out, I needed a carriage return to be allowed instead. \r Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.