Re: Help with validating a date input to a dialog
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