Ensuring numeric input

Lynch, Jonathan bnz2 at cdc.gov
Thu Oct 27 15:03:04 EDT 2005


It's a matter of interpretation...

My date interpretation will automatically complete a date.

11/9 becomes 11/09/05 (this year, next year it will be 11/09/06.

1/2 becomes 1/02/05


12/0w/05 would be automatically converted to 12/01/05...
2005/0w/14 would be converted to 12/01/2014...
This last one is because the American convention is Mo/Day/Year, and the
program is not set up for the year/mo/day convention (although it could
be, if that were ever an issue).

It can't be perfect, some things just cannot be interpreted.  In my
situation, I cannot afford to have an invalid date in a date field, or
it will cause a cascading list of problems - so I have to be rigid about
that. But I see what you mean, if possible, it would be better to be
nice to your user and allow them to correct an invalid date rather than
have to type it over.

-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Alex
Tweedly
Sent: Thursday, October 27, 2005 2:14 PM
To: How to use Revolution
Subject: Re: Ensuring numeric input

Lynch, Jonathan wrote:

>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.
>
>  
>
That sounds like a good approach, *except* (for someone as poor a typist

as me)

 - I type 2005/0w/14     (i.e. mis-hit the 'w' below the '2' that I was 
aiming for)
 - hit return (or tab or ...)
 - and because it's not a valid date, the whole lot goes and I need to 
start typing from scratch ??

Some days, I'd never complete typing a date ! :-)
Hopefully, you allow some way to get back the invalid typing so I can 
just edit that.


-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.361 / Virus Database: 267.12.5/149 - Release Date:
25/10/2005

_______________________________________________
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