Date Range Validation

Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default Date Range Validation

    Hello; [1] CL_FRST (08/10/2004) and CL_LST (05/24/2005) holds the beginning and
    ending date of school calendar which is also prepopulated for every school in
    the database table. This beginning and ending date is different for different
    schools corporations. VALIDATION: I need to collect some dates that user will
    enter like Canceled and makeup days. Those input dates must be between the e.g.
    CL_FRST (08/10/2004) and CL_LST (05/24/2005) dates or else a user gets the
    warning message. Currently my javascript is not working that I tried to
    incorporate fixing this problem. Any ideas on this java script or any other
    strategy of fixing this issue. <script language='JavaScript'> function
    nodefault() { // FAILED - Test For Day Always Falls Between Beginning &amp;
    Ending Calendar Day if ((document.cid.DLY_DSMSS_1.value < 'STD_CL_FRST') ||
    (document.cid.DLY_DSMSS_1.value > 'STD_CL_LST')) { alert ('Delay or
    Dismissed Early Day 1 Must Be Between Beginning and Ending Calendar Date');
    return false; } } </script> Thanks; <CF_Wish>

    CF_WISH Guest

  2. Similar Questions and Discussions

    1. Date Range
      I?ve got a routine that figure out 30 days from today?s date, but what I want to do is resolve a start date and an end date where the start date is...
    2. Date Range Search
      I have a calendar search from where an option is to search between dates and riight now it never finds anything. Do I need to do a format...
    3. Date Range from Week Number
      Has anyone ever tried to create a date range from a week number? Here is my scenario: I have a database with a primary key of weekNum. There are...
    4. Using WHERE statement to display date range
      I have a multi-year events database that is displayed on the web. But I also would like to display events from that database one week at a time. ...
    5. date range query
      Hi I just need to pull up a query which will bring up orders between a specified date range say jan 2003/ july 2002 and from this I have to pull up...
  3. #2

    Default Re: Date Range Validation

    I'm not too hot on Javascript but I DO see that you need to get the values in
    there rather than the field names. Javascript runs at the Browser and has no
    direct knowledge of database contents. CF must pass him the DB results.
    Assuming you've run a query called getDates above the Javascript, try: if
    ((document.cid.DLY_DSMSS_1.value < '#getDates.STD_CL_FRST#') ||
    (document.cid.DLY_DSMSS_1.value > '#getDate.STD_CL_LST#')) Do a view source
    and you should see the Dates in there. Now you get to figure out Date Compare
    logic in Javascript. (Perhaps convert all to YYMMDD text?) Good Luck.

    JMGibson3 Guest

  4. #3

    Default Re: Date Range Validation

    <cfif variableEntered LT 'CL_FRST' AND GT 'CL_LST'>
    Date entered is not between first and last day of school
    <cfelse>
    Date is legit
    </cfif>

    Not sure if you need the single quotes or not, you'll have to test it

    Tulsa Guest

  5. #4

    Default Re: Date Range Validation

    Hello;

    I was able to come up with this funtion in JavaScript but it's generating a
    warning message and not blocking a submission. Also it only generates a warning
    message if you click on cells or tab through it. Any suggestions will be
    appreciated.

    function checkdate(adate)
    {
    var currdate = new Date(adate.value)
    var dayfirst = new Date(document.cid.dayfirst.value)
    var daylast = new Date(document.cid.daylast.value)
    if (daylast < currdate)
    alert("Date Past Calender End. " + adate.value + " after " +
    document.cid.daylast.value)
    else if(dayfirst > currdate)
    alert("Date Before Calendar Beginning. " + adate.value + " before "
    + document.cid.dayfirst.value)
    }

    <input type="text" name="DLY_DSMSS_1" onChange="checkdate(this)">
    <input type="text" name="DLY_DSMSS_2" onChange="checkdate(this)">

    CF_WISH Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139