Re: Validate user input
Re: Validate user input
- Subject: Re: Validate user input
- From: Paul Skinner <email@hidden>
- Date: Tue, 06 Nov 2001 12:39:42 -0500
on 11/6/01 11:43 AM, Preston Smith wrote:
>
How do I confirm that a user has entered only numerals, or certain
>
punctuation marks, into a dialog box?
>
>
>
>
Preston Smith
set goodValue to false
repeat while goodValue is false
set goodValue to true
display dialog "Input numbers or . - _" default answer "1234c.123"
set userinput to the text returned of the result
set permittedChars to every character of "1234567890.-_"
repeat with thischar in (every character of userinput)
if permittedChars does not contain thischar then
display dialog "hey! I said use '1234567890.-_' only!"
set goodValue to false
end if
end repeat
end repeat
--For larger input you might prefer a TIDs break-check. If your input is
huge then say so and I'll post one.
--
Paul Skinner