Ensuring numeric input

Alex Tweedly alex at tweedly.net
Thu Oct 27 14:13:35 EDT 2005


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




More information about the use-livecode mailing list