• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Validate user input
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Validate user input (From: Preston Smith <email@hidden>)

  • Prev by Date: Re: Validate user input
  • Next by Date: Internet Explorer
  • Previous by thread: Validate user input
  • Next by thread: Re: Validate user input
  • Index(es):
    • Date
    • Thread