Re: Validate user input
Re: Validate user input
- Subject: Re: Validate user input
- From: Michelle Steiner <email@hidden>
- Date: Tue, 6 Nov 2001 10:17:17 -0700
On 11/6/01 9:43 AM, Preston Smith <email@hidden> wrote:
>
How do I confirm that a user has entered only numerals, or certain
>
punctuation marks, into a dialog box?
Here is one way.
--Michelle
set validchars to "1234567890" --add other valid characters here
set dataInput to text returned of (display dialog "Enter something"
default answer "")
if dataInput is not "" then
repeat with testchar in dataInput
if (offset of (testchar) in validchars) is 0 then
display dialog testchar & " is not a valid input."
else
--process input
end if
end repeat
else
display dialog "You really must enter something."
end if
----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spiritual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------