Originally posted by Eric Pascarello:
you should be using onchange or onblue and not onpaste.
^[a-zA-Z\s]*$
^\d*\.\d*$
Eric
Actually if the first field goes alphanum, it would be
^[\w\s]*$.
Also, the thing with change/blur events is, they occur only once the user leaves the field, not when the value changes. There's no portable event for immediate change reaction, AFAIK.
A middle-of-the-road solution would be to periodically observe the field and strip whichever chars are invalid.
Something like this perhaps (untested):
Obviously, this should be namespaced and/or encapsulated properly, perhaps using Prototype's
Field.Observer class�