realbasic-nug
[Top] [All Lists]

Re: Field validation

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Field validation
From: Seth Willits <seth at freaksw dot com>
Date: Fri, 28 Jun 2002 11:47:29 -0700
On 6/28/02 11:31 AM, the NSA intercepted the following message from "Brian
Seavers" <brian at bsweb dot co dot uk>:

> Hi everyone
> 
> This MUST have been covered many times, but I haven't been able to
> find it through the archives.
> 
> I'm looking for simple editfield validation, i.e reject
> non-alphanumeric characters (and allow spaces !) as they are typed in
> an editfield.


Function KeyDown
  if InStr("0123456789" + chr(8) + chr(13) + chr(9) + chr(3), key) > 0 then
    return false
  elseif asc(key) > 27 and asc(key) < 32 then
    return false
  else
    return true
  end if
End Function


That's all there is to it.


Seth Willits
---------------------------------------------------------------------------
President and Head Developer of Freak Software - http://www.freaksw.com
Q&A Columnist for REALbasic Developer Magazine - http://www.rbdeveloper.com

"It's okay. We can't all have three digit IQ levels."
    -- Me
---------------------------------------------------------------------------





<Prev in Thread] Current Thread [Next in Thread>