• 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: Allen Watson <email@hidden>
  • Date: Tue, 06 Nov 2001 10:48:39 -0800

On Tue, 6 Nov 2001 10:17:17 -0700, Michelle Steiner <email@hidden>
wrote:
Rather than that ugly "offset of" construct, I would use:

if (testchar is not in validchars) then

Also, it might be desirable to add a "return" after the display dialog of
the invalid character, unless you want to handle a separate dialog for every
incorrect character.

> 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

--
Allen Watson, Portland, OR -- <email@hidden>
My web page: <http://home.earthlink.net/~allenwatson/>
Teach only love, for that is what you are. (A Course in Miracles)


  • Prev by Date: Re: Script objects 'as string' in an identifiable way
  • Next by Date: Quark guide placement scripting
  • Previous by thread: Re: Validate user input
  • Next by thread: Re: Validate user input
  • Index(es):
    • Date
    • Thread