Hey Rod,
You can do this by using simple javascript + a coldfusion page.
Coldfusion caller Page
----------------------
<table>
<TR bgcolor="#eeeeee">
<TD align="right" valign="top" class="qText">From Date</TD>
<TD valign="top">
<Input type="text" name="v_from_date" size="10" value="27/03/2003"> Date
Format (dd/mm/yyyy)
<a href="javascript:ShowCalendar('frmorderplaced', 'v_from_date')">select
date</a></td>
</TR>
<TR>
<TD align="right" valign="top" class="qText">To Date</TD>
<TD valign="top">
<Input type="text" name="v_date" size="10" value= "27/03/2003">Date Format
(dd/mm/yyyy)
<a href="javascript:ShowCalendar('frmorderplaced', 'v_date')">select
date</a></td>
</TR>
</table>
<input type="button" name="SrchKey" value = "Search" onclick="return
validatedate()">
include javascript in the caller page
-------------------------------------
<SCRIPT TYPE="text/javascript">
<!--
function ShowCalendar(FormName, FieldName) {
window.open("calendar.cfm?FormName=" + FormName +
"&FieldName=" +
FieldName, "CalendarWindow", "width=250,height=210,top=450,left=500");
}
//-->
</script>
calendar.cfm page
-----------------
<html>
<head>
</head>
<body>
<cfheader name="Expires" value="#Now()#">
<!--- Set the month and year parameters to equal the current values
if they do not exist. --->
<!--- <cfparam name="month" default="#DatePart("m", Now())#">
<cfparam name="year" default="#DatePart("yyyy", Now())#">
--->
<cfparam name="month" default="#DatePart("m", Now())#">
<cfparam name="month1" default="#Dateformat(now(), 'mmm')#">
<cfparam name="year" default="#DatePart("yyyy", Now())#">
<!--- Set the requested (or current) month/year date and determine the
number of days in the month. --->
<cfset ThisMonthYear = CreateDate(year, month, '1')>
<cfset Days = DaysInMonth(ThisMonthYear)>
<!--- Set the values for the previous and next months for the back/next
links. --->
<cfset LastMonthYear = DateAdd("m", -1, ThisMonthYear)>
<cfset LastMonth = DatePart("m", LastMonthYear)>
<cfset LastYear = DatePart("yyyy", LastMonthYear)>
<cfset NextMonthYear = DateAdd("m", 1, ThisMonthYear)>
<cfset NextMonth = DatePart("m", NextMonthYear)>
<cfset NextYear = DatePart("yyyy", NextMonthYear)>
<script language="JavaScript">
<!--
// function to populate the date on the form and to close this window. --->
function ShowDate(DayOfMonth) {
<cfoutput>
var FormName="#FormName#";
var FieldName="#FieldName#";
var DateToShow="#month#-" + DayOfMonth + "-#year#";
if (#len(month)# > 1)
{var DateToShow= DayOfMonth + "/#month#" + "/#year#"; }
if (#len(month)# == 1)
{var DateToShow= DayOfMonth + "/0#month#" + "/#year#"; }
eval("self.opener.document." + FormName + "." + FieldName +
".value=DateToShow");
window.close();
</cfoutput>
}
//-->
</script>
<table border="0">
<tr>
<td align="center">
<!--- Display the current month/year as well as the back/next
links. --->
<cfoutput>
<span class="label">
<nobr>
<a
href="calendar.cfm?month=#LastMonth#&year=#LastYear#&FormName=#URLEncodedFor
mat(FormName)#&FieldName=#URLEncodedFormat(FieldName)#"><<</a>
#MonthAsString(month)# #year#
<a
href="calendar.cfm?month=#NextMonth#&year=#NextYear#&FormName=#URLEncodedFor
mat(FormName)#&FieldName=#URLEncodedFormat(FieldName)#">>></a>
</nobr>
</span>
</cfoutput><p>
<table border="1">
<!--- Display the day of week headers. I've truncated the values to
display only
the first three letters of each day of the week. --->
<tr>
<cfloop from="1" to="7" index="LoopDay">
<cfoutput>
<td width="50" align="center">
<span class="label">#Left(DayOfWeekAsString(LoopDay),
3)#</span>
</td>
</cfoutput>
</cfloop>
</tr>
<!--- Set the ThisDay variable to 0. This value will remain 0 until
the day
of the week on which the first day of the month falls on is
reached. --->
<cfset ThisDay = 0>
<!--- Loop through until the number of days in the month is
eached. --->
<cfloop condition="ThisDay LTE Days">
<tr>
<!--- Loop through each day of the week. --->
<cfloop from="1" to="7" index="LoopDay">
<!--- If ThisDay is still 0, check to see if the current day
of the week
in the loop matches the day of the week for the first day of
the
month. --->
<!--- If the values match, set ThisDay to 1. --->
<!--- Otherwise, the value will remain 0 until the correct day
of
the week is found. --->
<cfif ThisDay IS 0>
<cfif DayOfWeek(ThisMonthYear) IS LoopDay>
<cfset ThisDay=1>
</cfif>
</cfif>
<!--- If the ThisDay value is still 0, or it is greater than
the number
of days in the month, display nothing in the column. --->
<!--- Otherwise, display the day of the month and increment
the value. --->
<cfif (ThisDay IS NOT 0) AND (ThisDay LTE Days)>
<cfoutput>
<td align="center">
<a href="javascript:ShowDate(#ThisDay#)"><span
class="small">#ThisDay#</span></a>
</td>
</cfoutput>
<cfset ThisDay=ThisDay + 1>
<cfelse>
<td> </td>
</cfif>
</cfloop>
</tr>
</cfloop>
</table>
</td>
</tr>
</table><p>
</body>
</html>
onlick of the select date link will invoke calendar.cfm that displays a
calendar. Onclick of a date will get you a formatted date in your html input
boxes.
Hope that helps.
Warm Regards,
Sameer Kekade.
QUATRO FOUR RETAIL
"The right connections for your business"
Tel. direct +61 2 9370 2775
Fax direct +61 2 9370 1200
Mobile 0411 566 650
[EMAIL PROTECTED]
www.quatro.com.au
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of COLLINS,
Rodney
Sent: Thursday, 27 March 2003 5:10 PM
To: CFAussie Mailing List
Subject: [cfaussie] Date input on Form
Guys,
I have a form that has to accept a date from a user.
<CFQUERY> then needs to insert FORM.EnteredDateString into an Oracle
database.
What is the best, or at least accepted, way of doing this. Bearing in mind
that, although prompted with a default of today's date in the correct
format, the user can, and probably will, enter anything, even nothing. Is
there a function, or group of functions, that can make sure a) the date is
defined, b) it is a actually a date, and c) it is read in the Australian
format.
I seem to be running around in cirlces getting DateFormat etc to do what I
expect them to do, and we are toying with several different ways of doing
this.
Another problem is that the form contains two dates, one is required, the
other is not.
Ideas please.
Thank you,
Rod Collins
Business Systems Analyst/Programmer
Information Services Department
BAE SYSTEMS Australia Ltd.
PO Box 1068 Salisbury SA 5108
AUSTRALIA
Telephone +61 8 8480 7662
Facsimile +61 8 8480 8866
Mobile 0414 929 721
Email: [EMAIL PROTECTED]
http://www.baesystems.com
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/