Fw: Validate user input
Fw: Validate user input
- Subject: Fw: Validate user input
- From: "AppleScripter" <email@hidden>
- Date: Tue, 6 Nov 2001 13:24:57 -0600
>
How do I confirm that a user has entered only numerals, or certain
>
punctuation marks, into a dialog box?
There have been a couple of good posts with good scripts. If the "certain
punctuation marks" are just a period and a comma, then you could probably do
this a lot easier than looping through every character. Just force a
coercion and trap the error. This is untested:
display dialog "Type in a number:" default answer ""
set validateMe to the text returned of the result
try
set validatedNumerics to validateMe as real --or integer or number depending
on error
display dialog "Not a number. Please try again."
end
Greg Strange