Alan,
I ran across this problem just last week, and this is how I finally did it.
It's not pretty but it works:
<cfif isDefined ("form.StartDte") and #form.StartDte# neq ''>
<cfset st_dte = #dateformat(form.StartDte, 'mm/dd/yy')#>
<cfelseif isDefined ("url.StartDte") and #url.StartDte# neq ''>
<cfset st_dte = #dateformat(url.StartDte, 'mm/dd/yy')#>
<cfelse>
<cfset st_dte = #now()#>
</cfif>
<cfif isDefined ("form.EndDte") and #form.EndDte# neq ''>
<cfset EndDte = #dateformat(form.EndDte, 'mm/dd/yy')#>
<cfelseif isDefined ("url.EndDte") and #url.EndDte# neq ''>
<cfset EndDte = #dateformat(url.EndDte, 'mm/dd/yy')#>
<cfelse>
<cfset EndDte = #now()#>
</cfif>
<cfparam name="startYear" default="#year(st_dte)#">
<cfparam name="startMonth" default="#month(st_dte)#">
<cfparam name="startDay" default="#day(st_dte)#">
<cfparam name="endYear" default="#year(EndDte)#">
<cfparam name="endMonth" default="#month(EndDte)#">
<cfparam name="endDay" default="#day(EndDte)#">
<cfset startdate = CreateDate(startYear, startMonth, startDay)>
<cfset st_Dte = #DateFormat(startdate, 'mm/dd/yy')#>
<cfset endingdate = CreateDate(endYear, endMonth, endDay)>
<cfset end_Dte = #DateFormat(endingdate, 'mm/dd/yy')#>
Then I pass the date in the url like this, all in one line, of course:
<a
href="web_page.cfm?startYear=<cfoutput>#startYear#</cfoutput>&startMonth=<cfoutput>#startMonth#</cfoutput>&startDay=<cfoutput>#startDay#</cfoutput>
&endYear=<cfoutput>#endYear#</cfoutput>&endMonth=<cfoutput>#endMonth#</cfoutput>&endDay=<cfoutput>#endDay#</cfoutput>">Page</a>
Zelda
-----Original Message-----
From: Adrian Lynch [mailto:[EMAIL PROTECTED]
Sent: Friday, May 16, 2008 8:47 AM
To: CF-Newbie
Subject: RE: Can CF format a form value on submit ?
Try:
<cfset dateString = "16 May 2008">
<cfoutput>
#DateFormat(dateString, "ddmmyyyy")# </cfoutput>
Adrian
http://www.adrianlynch.co.uk/
-----Original Message-----
From: a or [mailto:[EMAIL PROTECTED]
Sent: 16 May 2008 12:03
To: CF-Newbie
Subject: Can CF format a form value on submit ?
Hi,
Is it possible to format a form value on submit using only Cold Fusion ?
I am using a calendar to populate a form field in the following format 16 May
2008.
When I submit the form, I need the URL string to read as index.cfm?16052008 and
NOT index.cfm?16+May+2008
Is this possible to do this using ColdFusion only or should I use Javascript
(or a combination of both maybe ?? using DateFormat inside a javascript
function.
thanks in advance,
alan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive:
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3635
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15