Hi, now I tried to set up the FormElementManager for my custom forms and form elements and I feel a little lost. Here is my configuration for a simple form:
------------------------------------------------------------------------ 'form_elements' => array( 'invokables'=> array( 'Description' => 'MyLib\Form\Element\Description', ), 'factories' => array( 'User\Settings' => 'User\Form\SettingsFormFactory', ), 'shared' => array( 'User\Settings' => true, ), ), ------------------------------------------------------------------------ My SettingsForm adds an description element in the init() method with a $this->getFormFactory()->createElement() call. The custom element is found as expected when the form is created with the help of the FormElementManager. But when it comes to the form factory my head starts spinning. This does not work because this form cannot access my custom description element since it is unknown. ------------------------------------------------------------------------ class SettingsFormFactory implements FactoryInterface { public function createService( ServiceLocatorInterface $serviceLocator ) { $form = new SettingsForm(); $form->init(); return $form; } } ------------------------------------------------------------------------ >From the docs I learned that I need to use the FormElementManager to create a form when I want to access my custom description element. So I tried the following: ------------------------------------------------------------------------ class SettingsFormFactory implements FactoryInterface { public function createService( ServiceLocatorInterface $serviceLocator ) { $form = $serviceLocator->get('User\Form\SettingsForm'); return $form; } } ------------------------------------------------------------------------ The form is created with the description element. But I noticed that within my process I get two different objects of the User\Form\SettingsForm which leads to some MultiCheckBox elements which get their valueOptions within the factory and only one of these two instances have the valueOptions set. I tried to find this error for a couple of hours now without success. Now I wonder if the approach within my SettingsFormFactory is correct. I just feels wrong to write a factory to create an object and within this factory I have to use the FormElementManager to create this form again... Any advice? Thanks and best regards, Ralf P.S. I would love to provide a full example. But form creation is quite complex in my application and uses a listener to create the forms only when needed by a model-service or controller... -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com