+ Start a Discussion
Cable Guy.ax375Cable Guy.ax375 

Dynamically Building Month and Year Dropdown

Does anyone have existing code of dynamically building a dropdown in controller so that on the visualforce page would look like this (it always starts from current month and current year) for the next 24 months:

 

Aug-2010

Sep-2010

Oct -2010

Nov-2010

Dec-2010

Jan-2011

Feb-2011

Mar-2011

...

...

 

with value:

8-2010

9-2010

10-2010

11-2010

12-2010

1-2011

2-2011

3-2011

...

...

 

 

Any help will be greatly appreciated.

Best Answer chosen by Admin (Salesforce Developers) 
Pradeep_NavatarPradeep_Navatar

Have you used jquery date picker? It is not exactly the same you are asking for but is a nice tool.

 

This Component When used will place a TextInput with a calendar icon adjacent to the input control, so as to Popup a Calendar and have selected Date inserted in the input control, just like the Date Control of Salesforce, which is currently Bounded to be Used only with Data Bounded Fields.

 

So this way, you simple place a call like: <c:jQueryPickDate pickDateLabel="Pick Date:" pickDateField="selectDate" value="{!selectedDate}" />

 

And you will have a Date Control on you VisualForce page.

All Answers

krishnagkrishnag

hey even i am looking for same functionality let me know if you find some answer.

Pradeep_NavatarPradeep_Navatar

Have you used jquery date picker? It is not exactly the same you are asking for but is a nice tool.

 

This Component When used will place a TextInput with a calendar icon adjacent to the input control, so as to Popup a Calendar and have selected Date inserted in the input control, just like the Date Control of Salesforce, which is currently Bounded to be Used only with Data Bounded Fields.

 

So this way, you simple place a call like: <c:jQueryPickDate pickDateLabel="Pick Date:" pickDateField="selectDate" value="{!selectedDate}" />

 

And you will have a Date Control on you VisualForce page.

This was selected as the best answer