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
on openfield replace "-" with empty in me end openfield on closefield doHyphens end closefield on exitfield doHyphens end exitfield On Sun, Jul 1, 2012 at 10:14 AM, Dr. Hawkins <doch...@gmail.com> wrote: > 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 me > if theKey is among the chars of "0123456789" then > pass keyup > else > beep > end if > > end keyUp > > If I blast a bunch of numbers on the keyboard at once, I get extra > numbers before the hyphens: right now it shows 873124-6758021394 > > > -- > The Hawkins Law Firm > Richard E. Hawkins, Esq. > (702) 508-8462 > hawkinslawf...@gmail.com > 3025 S. Maryland Parkway > Suite A > Las Vegas, NV 89109 > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode