Ensuring numeric input

Lynch, Jonathan bnz2 at cdc.gov
Thu Oct 27 12:12:57 EDT 2005


I had to deal with this issue in my Task Mage app. When people enter
dates into the date column, or times into the time column, it has to be
a real date or real time, or else it will cause problems.

I addressed this in two ways. In the keydown handler I only allow
appropriate characters.

In the exitfield handler, the script tries to interpret what they wrote
and make it conform to the proper date or time format. If it does not
conform, the field is reverted to empty.

-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Ken Ray
Sent: Thursday, October 27, 2005 11:53 AM
To: Use Revolution List
Subject: Re: Ensuring numeric input

On 10/27/05 8:34 AM, "Lynch, Jonathan" <bnz2 at cdc.gov> wrote:

> .2 is a number
> . is just a period, not a number
> 
> -2 is a number
> - is just a minus sign, not a number

True... but that raises another UI issue - if the field has ".2" in it
and
someone attempts to delete the "2", do we keep the "." by itself in the
field, hoping someone will type another number and then tray it on
closeField to provide an alert? Or do we remove the decimal point as
well to
empty the field? And if we *do* remove the decimal, how would that be
different from having an empty field and typing a decimal point to start
a
decimal number; before the actual number is typed, there's just a
decimal
point in the field...

Hmm...

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com

_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list