Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / July 2007



Tip: Looking for answers? Try searching our database.

dateformat within cfselect flash form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matrosity - 26 Jul 2007 14:42 GMT
I'm needing to format smalldatetime sql field within cfselect in a flash form. How does one accomplish this?
ssawka - 27 Jul 2007 16:32 GMT
It's probably easiest to format the query prior to the cfselect generating.  
You can accomplish this a number of ways, but the most efficient way would be
to do it in the SQL Select.  How you do it depends on the DBMS that you are
using.
Matrosity - 27 Jul 2007 16:38 GMT
Could you provide an example? Thx!
ssawka - 27 Jul 2007 17:43 GMT
It would really depend on the DBMS that you are using.  The code example below
is for SQL Server.  Also, it would be helpful to know what query you are
running and what fields you're using in the CFSelect.

<cfquery name="MyQuery" datasource="#MyDS#">
     SELECT CONVERT(varchar,MyDateField,107) AS MyDate
     FROM MyTable
</cfquery>

...

<cfselect query="MyQuery" ... display="MyDate">
Matrosity - 27 Jul 2007 18:56 GMT
I got it handled a less elegant way but it works:

<cfformgroup type="HORIZONTAL" label="Choose an event:">
<cfselect name="eventday" size="1" width="150" visible="Yes" enabled="Yes"
required="Yes">
<cfloop query="events">
<cfoutput><option value = "#eid#">#dateformat(edate,
"long")#</option></cfoutput>
</cfloop>
</cfselect>
</cfformgroup>
cf_dev2 - 27 Jul 2007 19:33 GMT
A minor comment.  You don't need cfloop + cfoutput.  All you need is <cfoutput query="...">
Matrosity - 27 Jul 2007 19:37 GMT
I had that at first but then the flash form wouldn't display and CF 7 got stuck holding 30% cpu.
cf_dev2 - 27 Jul 2007 20:05 GMT
Weird. Works for me with MX7.

<cfformgroup type="HORIZONTAL" label="Choose an event:">
<cfselect name="eventday" size="1" width="150" visible="Yes" enabled="Yes"
required="Yes">
<cfoutput query="events">
<option value = "#eid#">#dateformat(edate, "long")#</option>
</cfoutput>
</cfselect>
</cfformgroup>
SamNUK - 29 Jul 2007 15:52 GMT
Could you not try it like this?

<cfselect name="eventday" size="1" width="150" visible="Yes" enabled="Yes" required="Yes" query="events" value="eid" display="#LSDateFormat(edate, 'DD/MM/YYYY')#" />
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.