Below is how i currently do date Selections, is there a cleaner way to do
this? I've read that loops tend to slow things down, but this seemed the
easiest thing to do at the time.
<cfif not isdefined("BIRTHDAY")>
<cfset BIRTHDAY = now()>
</cfif>
<label>DOB: </label>
<!--- Month --->
<select name="DOBMonth" id="DOBMonth">
<option>- -</option>
<cfloop index = "LoopCount" from = "1" to = "12">
<cfoutput>
<option value="#LoopCount#" <cfif isdefined("BIRTHDAY") AND LoopCount EQ
DateFormat(BIRTHDAY, "mm")>selected="selected"</cfif>>#LoopCount#</option>
</cfoutput>
</cfloop>
</select>
-
<!--- Day --->
<select name="DOBDay" id="DOBDay">
<option>- -</option>
<cfloop index = "LoopCount" from = "1" to = "31">
<cfoutput>
<option value="#LoopCount#" <cfif isdefined("BIRTHDAY") AND LoopCount EQ
DateFormat(BIRTHDAY, "dd")>selected="selected"</cfif>>#LoopCount#</option>
</cfoutput>
</cfloop>
</select>
-
<!--- Year --->
<cfset oldyear = Year(now())-100>
<select name="DOByear" id="DOByear">
<option value="">- - - -</option>
<cfloop index = "LoopCount" from = "#Year(now())#" to = "#oldyear#"
step="-1">
<cfoutput>
<option value="#LoopCount#" <cfif isdefined("BIRTHDAY") AND LoopCount EQ
DateFormat(BIRTHDAY, "yyyy")>selected="selected"</cfif>>#LoopCount#</option>
</cfoutput>
</cfloop>
</select>
--
--
Richard Dillman
[EMAIL PROTECTED]
(317) 916-8341
"IF-THEN-ELSE its a way of life!"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:244855
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54