Re: Validate user input
Re: Validate user input
- Subject: Re: Validate user input
- From: "Marc K. Myers" <email@hidden>
- Date: Tue, 06 Nov 2001 13:51:50 -0500
- Organization: [very little]
>
Date: Tue, 6 Nov 2001 10:43:05 -0600
>
To: email@hidden
>
From: Preston Smith <email@hidden>
>
Subject: Validate user input
>
>
How do I confirm that a user has entered only numerals, or certain
>
punctuation marks, into a dialog box?
property validChars : "1234567890-() "
set theText to text returned of [optn-L]
(display dialog "Enter some text:" default answer "")
repeat with i from 1 to (length of theText)
if character i of theText is not in validChars then
display dialog "\"" & (character i of theText) & [optn-L]
"\" is not a valid character"
exit repeat
end if
end repeat
Note the "[optn-L]" stands in for the AppleScript continuation character.
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[11/6/01 1:50:32 PM]