Question: I have a controller named class TestController which extends some Zend\_Controller\_Action. Now I would like to use create an instance of TestController in TestForms (a Zend\_Form). I want to populate a Zend\_Form\_Element\_Select dynamically.
Please suggest how I can do this. Thanx in advance.

Answer: 
Where are you instantiating the form - is it in the controller? Instead of having the form call an action on the controller to dynamically get the values, you should look at setting the values on the form after it has been instantiated. 

A quick and dirty way of doing that would be to grab the values in the controller and assign it to the element via:

```
$values = $db->query('query');
$element = $form->getElement('dynamicSelect');
$element->setValue($values);

```

Of course having DB queries to a table in your controller isn't exactly best practice... Per philistyne's suggestion, I use a a form builder class to build forms dynamically from my models. I have mappers for each model, and I pass in the mapper to the form builder class so it can dynamically populate my select elements.
A couple of things to try (passing a controller into a form or instantiating from within one is not recommended):

1. Use a model to access the dynamic values you want to put into your Zend\_Form\_Element\_Select.
2. If the form is complex, create a form builder class to take care of, and separate out, the heavy lifting of the form construction.
3. Create customised form elements by extending from Zend\_Form\_Element\_(Radio, Select, etc etc) if you feel you need very fine control over the form element's construction/behaviour/appearance, but wish to be able to reuse that element elsewhere.