Skip to main content
Inspiring
March 31, 2009
Question

Date Range Validation

  • March 31, 2009
  • 2 replies
  • 581 views
I need to ensure that users do not enter a End Date that is earlier than a Start Date and give them a mesage that Start Date can not be earlier than end date. Any idea how i might enforce that?
See
<cfform action="Uend.cfm">
<cfinput type="text" name="startdate" validate="date" required="yes" message="Starting when?">
<cfinput type="text" name="enddate" validate="date" required="yes" message="Till when?">
<cfinput type="submit" value="Go" name="pushbutton">
</cfform>
    This topic has been closed for replies.

    2 replies

    Inspiring
    April 1, 2009
    which validation are you talking about? client-side (javascript) or
    server-side (cf)?

    for server-side validation of date, cf has many useful functions like
    datecompare() for example.

    for client-side validation i would recomment employing a little useful
    date.js (google "date.js" to find it) library which can parse manymany
    date formats and do a lot with them...

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    Inspiring
    March 31, 2009
    You'll have to write your own javascript and/or write some cold fusion code on your action page.