• 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: Help with validating a date input to a dialog
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with validating a date input to a dialog


  • Subject: Re: Help with validating a date input to a dialog
  • From: Paul Berkowitz <email@hidden>
  • Date: Fri, 30 Mar 2001 20:28:39 -0800

On 3/30/01 7:29 PM, "Michelle Steiner" <email@hidden> wrote:

> On 3/30/01 6:46 PM, Paul Berkowitz <email@hidden> wrote:
>
>> Assuming you've put the escape characters back in, add a
>>
>> global DateToSend
>
> that did it; thanks.

There are some people who don't like globals (seems unfair to me), although
I haven't seen Scott Norton around in a while! Still, before anyone jumps on
me, there's another way to do this that doesn't require a global: just set
DateToSend in the 'on error' statement to the recursion which returns (its
own) DateToSend. Like so:


display dialog (my setthedate("Please enter the date in format
\"mm/dd/yyyy\"."))

on setthedate(prompt)

set DateToSend to (text returned of (display dialog prompt default
answer ""))
try
date DateToSend
on error
set DateToSend to my setthedate("Please us the correct format
\"mm/dd/yyyy\"")
end try
return DateToSend
end setthedate


That would permit you to run the handler another time, non-recursively,
later in the script if you should so want.



--
Paul Berkowitz


References: 
 >Re: Help with validating a date input to a dialog (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: Help with validating a date input to a dialog
  • Next by Date: Re: Help with validating a date input to a dialog
  • Previous by thread: Re: Help with validating a date input to a dialog
  • Next by thread: Re: Help with validating a date input to a dialog
  • Index(es):
    • Date
    • Thread