You need to sign in to do that
Don't have an account?
How to add dynamic select list
I want to create a dynamic select list. Below is my code:
Component.Apex.SelectList selectDynamic = new Component.Apex.SelectList();
selectDynamic.multiselect = false;
selectDynamic.value = stringList;
Component.Apex.SelectOptions dynamicOptions = new Component.Apex.SelectOptions();
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('hi','hi'));
dynamicOptions.value = options;
selectDynamic.childComponents.add(dynamicOptions);
on the page load I'm getting error "Invalid selectOptions found. Use SelectOption type in Apex."
I haven't been able to make it work with the SelectOptions component either, at least in Dynamic VF; I get the same message as you do.
Instead, create the individual Component.Apex.SelectOption objects and add them directly to the SelectList: Don't forget that, for a SelectList, the multiSelect and size options should be specified in the constructor (if you want other than defaults).
Best,
Doug