DOH yep, so shoulda been if not offset("-",me) > 0 then ...
I went the direction of inserting the hyphens after the fact to make it
easier to foil a stubborn user. Just limit the input to numbers and insert
the hyphens after exitfield/closefield. (though you can paste invalid text
into the field
On Jul 1, 2012, at 12:31 PM, Mike Bonner wrote:
> Does this work better for you?
>
> on keydown pKey
> if the length of me < 9 and pKey is a number then
> pass keydown
> else
> beep
> end if
> end keydown
>
> command doHyphens
> if not offset("-",me) then
This will be a prob
Does this work better for you?
on keydown pKey
if the length of me < 9 and pKey is a number then
pass keydown
else
beep
end if
end keydown
command doHyphens
if not offset("-",me) then
put "-" after char 5 of me
put "-" after char 3 of me
end if
end doHyphens
I' surprised at how slow this is--I can type fast enough to foul it.
American social security numbers have nine digits, with a dash after
the third and fifth.
I attached this to a field to handle it automatically
on keyUp theKey
if the length of me = 3 or the length of me=6 then put "-" after