Ensuring numeric input
Michael J. Lew
michaell at unimelb.edu.au
Thu Oct 27 18:58:56 EDT 2005
Sorry Ken. Your script works well in a one-line field, but I need it
to work in a many line field (maybe I didn't say that in the first
place).
At 12:27 AM -0500 27/10/05, use-revolution-request at lists.runrev.com wrote:
>Try this one (script of the field):
>
>on keydown whichKey
> if whichKey is among the chars of "01234567890.-" then
> put me into tTemp
> put word 2 of the selectedChunk into sChar
> put word 4 of the selectedChunk into eChar
> if eChar > sChar then -- some text is selected
> delete char sChar to eChar of tTemp
> end if
> put whichKey after char eChar of tTemp
> if isNumber(tTemp) then pass keyDown
> end if
>end keyDown
>
>Basically it checks to see if the end product would end up with a numeric
>value, and if so, it will allow the keystroke to happen.
>
>BTW: There was no reason to trap for backspace/delete as there isn't a way
>AFAIK to remove some or part of a number and have the end result *not* be a
>number.
>
>HTH,
>
>Ken Ray
At 5:44 AM -0500 27/10/05, Richard Gaskin wrote:
>Judy Perry wrote:
> > Of course, they just told me today that they think that it is possible for
> > a computerized voting scheme to have an error rate of <1%.
>
>It's not the errors I'm concerned about as much as vulnerabilities and
>no audit trail.
>
>Bartcop's Second Law of Economics:
>
> "If someone makes a mistake
> that puts money in their pocket,
> you can bet they'll make that mistake
> again, and again, and again..."
This will get me into trouble if anyone notices it here at the bottom:
It is very important to recognize the folly of corruptible voting
machines and to accept the possibility that elections are rigged.
However, it is MUCH more important that people think about why they
voted the way they did. They shouldn't be misled in the same way a
second (third?) time. A little reflection and self-knowledge is
called for: half of us owe the other half a confession of mea culpa.
--
Michael J. Lew
Senior Lecturer
Department of Pharmacology
The University of Melbourne
Parkville 3010
Victoria
Australia
Phone +613 8344 8304
**
New email address: michaell at unimelb.edu.au
**
More information about the use-livecode
mailing list