Download the EasyCFM.COM Browser Toolbar!
Set Credit Card Years Forever

Set Credit Card Years Forever

<cfparam name="fromYear" default="#DateFormat(Now(),"yyyy")#">
<cfset toYear= fromYear + 5>

<select name="cardYear">
    <option value=
"0" <cfif fromYear eq "0">selected</cfif>>
Select Year</option>
    <cfoutput>
    <cfloop index="year" from="#DateFormat(Now(),"yyyy")#" to="#toYear#" step="+1">
        <option value="#year#" <cfif fromYear eq year>selected</cfif>>#year#</option>
    </cfloop>
    </cfoutput>
</select>

All ColdFusion Tutorials By Author: Carlos Batista
  • Set Credit Card Years Forever
    I downloaded a tutorial for populating a year select list and made some changes that I think will be helpful to you. Once you set it up, you don’t have worry about it anymore. It will populate itself with the years from current to whatever number of years you want.
    Author: Carlos Batista
    Views: 11,147
    Posted Date: Monday, May 14, 2007