Ask a Question related to Macromedia ColdFusion, Design and Development.
-
Boiler2005 #1
Date Selection
Hi,
I am trying to make a drop down for the user to select the month and date...
Since Month(1-12) does change through time I have hard coded that... Year
however does, and I am trying to make this selection dropdown dynamic. My
attempt so far is to <cfset current_year = DateFormat(Now(),"yyyy")> Which
=2005 ... Then I am trying to run a loop <CFLOOP CONDITION="current_year LESS
THAN OR EQUAL TO 2004"> Which is the oldest the date will ever need to be...
This way in 5 years the drop down will still work... I use this for the loop
<CFSET current_year = current_year - 1> .....
However all this isn't working and I can not figure out why.. Any ideas? Or is
there a better way to go about this? Thank you in advance... I have pasted the
code below...
<cfset current_year = DateFormat(Now(),"yyyy")>
Year:
<select name="date_y" style="vertical-align: middle">
<CFLOOP CONDITION="current_year LESS THAN OR EQUAL TO current_year2">
<option value="current_year">#current_year#</option>
<CFSET current_year = current_year - 1>
<CFOUTPUT>#current_year#</CFOUTPUT>
</CFLOOP>
</select>
Boiler2005 Guest
-
JSObject returns wrong date. How can Iextract correct date from digital signature?
I'm trying to extract name and date from digital signatures by using JSObject in Excel VBA, but JSObject returns wrong date. Year, month, hour and... -
#39245 [NEW]: date function generate wrong date with 1162083600 timestamp
From: lohner at aldea dot hu Operating system: Linux PHP version: 5.1.6 PHP Bug Type: Date/time related Bug description: ... -
a Calendar control with date range selection
http://cheapdevtools.com/product/product.asp?ProdID=246 -
a Calendar with date range selection, year navigation
http://cheapdevtools.com/product/product.asp?ProdID=246 -
how to refresh page after date selection from popup calendar?
If you are using window.open to popup the calendar, then before closing the popup you can use 'opener ' handler which gives you the parent page to... -
Vbprog40 #2
Re: Date Selection
I hope im understanding this corrently. You want to display now: 2005 and
2004 in the dropdown Next year you want to display: 2006, 2005, 2004...? Try
this: <cfset current_year = DateFormat(Now(),'yyyy')> <select name='date_y'
style='vertical-align: middle'> <CFLOOP CONDITION='#current_year# GTE '2004''>
<cfoutput> <option value='current_year'>#current_year#</option> </cfoutput>
<CFSET current_year = current_year - 1> </CFLOOP> </select>
Vbprog40 Guest
-
Another Phil #3
Re: Date Selection
Boiler2005,
I was writing this in notepad and did not have a chance to check it... So the
syntax might be slightly off if my memory didn't serve me correctly.
<cfset thisyear=#DateFormat(Now(), 'yyyy')#>
<cfset yearstoshow=5>
<cfoutput>
<select name="year" size="1" onChange="document.showdate.submit()">
<cfset thisyear = #thisyear# - 1>
<cfloop from="1" to="#yearstoshow#">
<option value=#thisyear#>#thisyear#</option>
<cfset thisyear = #thisyear# +1>
</cfloop>
</select>
</cfoutput>
Will make a drop down showin last year, this year, and the next 3 years. Can
easily be edited to work for your needs.
Change: <cfset thisyear = #thisyear# - 1> to subtract the number of years you
want and <cfset yearstoshow=5> to show a greater range of years.
-Phil
Another Phil Guest



Reply With Quote

