Ask a Question related to Coldfusion - Getting Started, Design and Development.
-
CF_WISH #1
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 &
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
-
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... -
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... -
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... -
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. ... -
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... -
JMGibson3 #2
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
-
Tulsa #3
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
-
CF_WISH #4
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



Reply With Quote

