nelsonm - 4:54 pm on Nov 10, 2012 (gmt 0)
I appreciate and understand your concerns about styling but i was more interested in opinions about the method to insure that the year part of the exp. date select block would function correctly year after year.
I use the exp. date select block in multiple places on the site, so defining it in one place as a function and inserting the options into empty select tags where needed is better than having static multiple code copies duplicated throughout the site.
While the method constructs all the select year options from the base year through the current year plus 11 more years, only the current plus 11 years are visible and selectable in the drop down list. Past year options are disabled and hidden in the drop down list but still can be displayed when the values are given.
The method updates the visible 12 year range automatically year after year while still allowing past dates retrieved from the database to be displayed. The only thing the method won't do, is allow you to select one of those past years.
The method does work to year 9999. Try it yourself by setting "ThisYear = 9988".
I realize this is not earth shattering innovation, but i thought it was cool.