macromedia.coldfusion.cfml_general_discussion
[Top] [All Lists]

Age Verification Form - invalid date or time string

Subject: Age Verification Form - invalid date or time string
From: Earl
Date: Wed, 29 Aug 2007 21:02:40 -0500
Newsgroups: macromedia.coldfusion.cfml_general_discussion

I have a form with Month + Day + Year drops downs.
User selects their DOB and if GTE 13 from NOW they're in.

Problem is if someone selects a date that doesn't exist like 9/31 CF throws an error that I can't figure out how to
prevent  -  ""31/9/1976" is an invalid date or time string."

Client wants the individual drops downs. If I use a single box and cfinputs with "date" validation it will catch these illegal dates. Question is how can I catch them using 3 individual strings from my m/d/y drop downs?
This is my code

  <!--- Compile Form input --->
  <cfset userDOB = "#form.day#/#form.month#/#form.year#">

  <!--- Calculating age difference --->
  <cfset userAge = datediff("yyyy",variables.userDOB, now())>

<Prev in Thread] Current Thread [Next in Thread>