Think of something that you wish Authorware could do but it doesn't?
Let the our good friends at Macromedia know via the wishlist.
Please let us know if you find
any of the materials on this site inappropriate or offensive. Please include
the url and why the material should be reviewed.
Comments and questions about the site are also welcome. Please no Authorware
questions, use the AWARE
There are 0 reviews
B8005 - How can I ensure that the date the end user has entered is valid?
by - Joseph Ganci
For example, 02-29-2000 exists but 02-29-1999 doesn't or 01-31-2000 exists but 02-31-2000 doesn't. How can I be sure they enter a correct date?
The following script will do the trick. This assumes the month is first, then the day, then the year. If you want to check a different order, change the numbers in the GetNumber calls below.
mydate := "2-28-1999"
mymonth := ABS(GetNumber(1, mydate))
myday := ABS(GetNumber(2, mydate))
myyear := ABS(GetNumber(3, mydate))
number := DateToNum(myday, mymonth, myyear)
newdate := Date(number)
bad date := (myday <> Day(number) | mymonth <> Month(number) | myyear <> Year(number))
If the value of the variable bad date is TRUE (or 1), then the date entered was bad and you can alert the user to try again.
Add your review