• 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
Fw: Validate user input
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Validate user input
      • From: Paul Skinner <email@hidden>
  • Prev by Date: Re: Validate user input
  • Next by Date: attempting to count messages in Mail
  • Previous by thread: Re: Validate user input
  • Next by thread: Re: Validate user input
  • Index(es):
    • Date
    • Thread