You need to sign in to do that
Don't have an account?
Cable 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.
You can easily create dropdown list in visual force page using <apex:selectList/> and <apex:selectOptions> componemts of VF page. For an example :
<apex:selectList value=”{!optin}” id=”myList”>
<apex:selectOptions value=”{!optionsList}” />
</apex:selectList>
Here “option” is the property of controller which would hold the selected value of picklist, and “option List” is the list of dates generated in controller.
Hope this helps.
All Answers
You can easily create dropdown list in visual force page using <apex:selectList/> and <apex:selectOptions> componemts of VF page. For an example :
<apex:selectList value=”{!optin}” id=”myList”>
<apex:selectOptions value=”{!optionsList}” />
</apex:selectList>
Here “option” is the property of controller which would hold the selected value of picklist, and “option List” is the list of dates generated in controller.
Hope this helps.
Thanks. But I need to dynamically build this dropdown. Therefore, no hardcoding.