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: Drew Findley <drew at drewfindley dot com>
Date: Fri, 28 Jun 2002 11:35:50 -0700
I'm sure everyone else knows but where are the archives?

On Friday, June 28, 2002, at 11:31  AM, Brian Seavers wrote:

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.

I have placed the following code in the 'TextChange' event of the editfield :

  dim txt as string

  txt="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 "

  if instr(1,txt,mid(me.text,me.selstart,1))<1 then
    me.text=replace(me.text,mid(me.text,me.selstart,1),"")
    me.selstart=me.selstart-1
  end if

Now... this IS working, but it is visibly slow (can see the 'replace' happen on my iMac 400 DVSE,[compiled!])...

There must be a neater way of doing this ! Any ideas ?

Thanks

Brian
--
---
Subscribe to the digest: <mailto:realbasic-nug-
digest at lists dot realsoftware dot com>
Unsubscribe:
<mailto:realbasic-nug-off at lists dot realsoftware dot com>



________________________________________________________

Drew Findley
Light & Sound Design, Inc / Fourthphase
drew at drewfindley dot com
________________________________________________________



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