Skip to main content
Inspiring
March 25, 2008
Question

cfinput date validation

  • March 25, 2008
  • 2 replies
  • 687 views
I have the following date input :

<cfinput type="text" name="date_arrived" size="10" maxlength="10" value="#dateformat(now(), 'mm/dd/yyyy')#"
required="yes" validate="date" message="Please Enter The Date Arrived in MM/DD/YYYY Format">

The current date is displayed as soon as the form is opened. They are allowed to change the date. But if they put in something like 13/25/2008 instead of 03/25/2008, it does not validate and iit blows up with the following error :

"13/25/2008" is an invalid date or time string.

There are some other javascript edits for other fields on the form, but not for the date.
    This topic has been closed for replies.

    2 replies

    Participating Frequently
    March 25, 2008
    When I tried "13/25/2008" as date I have the following popup error.

    "Please Enter The Date Arrived in MM/DD/YYYY Format"

    trojnfnAuthor
    Inspiring
    March 25, 2008
    I do not understand what you are trying to tell me. The date entered obviously is invalid. Why did the cfinput validate=date not catch it, and let it submit and then blow up ?
    Participating Frequently
    March 26, 2008
    I mean it does the validation and show the error msg for me.

    Are you sure that you have the CFIDE directory in your root or mapped?
    Participating Frequently
    March 25, 2008
    What is the question?

    trojnfnAuthor
    Inspiring
    March 25, 2008
    The question is why does the date validation for cfinput not capture the error ? why does it allow a bogus date to be entered and then blowup ?