public function indexAction()
 {
     // action body
     $idEncuesta = $this->getParam("idEncuesta");
     $encuesta = $this->encuestaDAO->obtenerEncuesta($idEncuesta);
     $secciones = $this->seccionDAO->obtenerSecciones($idEncuesta);
     $formulario = new Zend_Form($encuesta->getHash());
     //debemos agregar a este formulario campos para identificar quien es el que esta llenando esta encuesta
     $eSubCabecera = new Zend_Form_SubForm();
     $eSubCabecera->setLegend("Datos Personales: ");
     $eEncuesta = new Zend_Form_Element_Hidden("idEncuesta");
     $eEncuesta->setValue($idEncuesta);
     $eReferencia = new Zend_Form_Element_Text("referencia");
     $eReferencia->setLabel("Boleta o Clave : ");
     $eReferencia->setAttrib("class", "form-control");
     $eReferencia->setDecorators($this->decoratorsPregunta);
     $eSubCabecera->addElements(array($eEncuesta, $eReferencia));
     $eSubCabecera->setDecorators($this->decoratorsSeccion);
     $formulario->addSubForm($eSubCabecera, "referencia");
     //============================================= Iteramos a traves de las secciones del grupo
     foreach ($secciones as $seccion) {
         //============================================= Cada seccion es una subforma
         $subFormSeccion = new Zend_Form_SubForm($seccion->getHash());
         $subFormSeccion->setLegend("Sección: " . $seccion->getNombre());
         //============================================= Obtenemos los elemntos de la seccion
         $elementos = $this->seccionDAO->obtenerElementos($seccion->getIdSeccion());
         foreach ($elementos as $elemento) {
             //============================================= Verificamos que tipo de elemento es
             if ($elemento instanceof Encuesta_Model_Pregunta) {
                 //============================================= Aqui ya la agregamos a la seccion
                 $this->agregarPregunta($subFormSeccion, $elemento);
             } elseif ($elemento instanceof Encuesta_Model_Grupo) {
                 //============================================= un grupo es otra subform
                 $subFormGrupo = new Zend_Form_SubForm($elemento->getHash());
                 $subFormGrupo->setLegend("Grupo: " . $elemento->getNombre());
                 $preguntasGrupo = $this->grupoDAO->obtenerPreguntas($elemento->getIdGrupo());
                 foreach ($preguntasGrupo as $pregunta) {
                     //============================================= Aqui ya la agregamos al grupo
                     $this->agregarPregunta($subFormGrupo, $pregunta);
                 }
                 $subFormGrupo->setDecorators($this->decoratorsGrupo);
                 $subFormSeccion->addSubForm($subFormGrupo, $elemento->getIdGrupo());
             }
         }
         $subFormSeccion->setDecorators($this->decoratorsSeccion);
         $formulario->addSubForm($subFormSeccion, $seccion->getIdSeccion());
     }
     $eSubmit = new Zend_Form_Element_Submit("submit");
     $eSubmit->setLabel("Enviar Encuesta");
     $eSubmit->setAttrib("class", "btn btn-success");
     $formulario->addElement($eSubmit);
     $formulario->setDecorators($this->formDecorators);
     $this->view->encuesta = $encuesta;
     $this->view->formulario = $formulario;
 }
Exemple #2
0
 /**
  * @see ZF-3272
  */
 public function testRenderedSubFormDtShouldContainNoBreakSpace()
 {
     $subForm = new Zend_Form_SubForm(array('elements' => array('foo' => 'text', 'bar' => 'text')));
     $form = new Zend_Form();
     $form->addSubForm($subForm, 'foobar')->setView(new Zend_View());
     $html = $form->render();
     $this->assertContains('<dt>&nbsp;</dt>', $html);
 }
 /**
  * @see ZF-2883
  */
 public function testDisplayGroupsShouldInheritSubFormNamespace()
 {
     $this->form->addElement('text', 'foo')->addElement('text', 'bar')->addDisplayGroup(array('foo', 'bar'), 'foobar');
     $form = new Zend_Form();
     $form->addSubForm($this->form, 'attributes');
     $html = $form->render(new Zend_View());
     $this->assertContains('name="attributes[foo]"', $html);
     $this->assertContains('name="attributes[bar]"', $html);
 }
 /**
  * Initiate system installation
  *
  */
 public function indexAction()
 {
     $settingsform = new Zoo_Form_Settings();
     $modulesform = new Zoo_Form_Modules();
     $form = new Zend_Form(array('name' => 'installForm'));
     $form->setSubFormDecorators(array('FormElements', 'Fieldset'));
     $form->addSubForm($settingsform, 'settings');
     $form->addSubForm($modulesform, 'modules');
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($settingsform->isValid($formData)) {
             //                $this->_forward('install');
         }
         $form->populate($formData);
     }
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Install');
     $form->addElements(array($submit));
     $this->view->form = $form;
 }
 public function testFormEnableShouldIncludeSubforms()
 {
     $form = new Zend_Form();
     $subform = new Zend_Form();
     $form->addSubForm($subform, "subform1");
     $this->assertFalse(false !== $form->getPluginLoader('element')->getPaths('ZendX_JQuery_Form_Element'));
     $this->assertFalse(false !== $form->getPluginLoader('decorator')->getPaths('ZendX_JQuery_Form_Decorator'));
     ZendX_JQuery::enableForm($form);
     $this->assertTrue(false !== $form->getPluginLoader('element')->getPaths('ZendX_JQuery_Form_Element'));
     $this->assertTrue(false !== $form->getPluginLoader('decorator')->getPaths('ZendX_JQuery_Form_Decorator'));
 }
 public function testRenderTranslate()
 {
     $this->useGerman();
     $decorator = new Application_Form_Decorator_TableHeader();
     $decorator->setColumns(array(array('label' => 'Value')));
     $form = new Zend_Form();
     $form->addSubForm(new Zend_Form_SubForm(), 'subform1');
     $decorator->setElement($form);
     $markup = $decorator->render('content');
     $this->assertEquals('<thead><tr><th class="">Text</th></tr></thead>content', $markup);
 }
 public function testGetJumpLinks()
 {
     $testForm = new Zend_Form();
     $subform = new Zend_Form_SubForm();
     $subform->setLegend('Subform 1');
     $testForm->addSubForm($subform, 'form1');
     $subform = new Zend_Form_SubForm();
     $subform->setLegend('Subform 2');
     $testForm->addSubForm($subform, 'form2');
     $subform = new Zend_Form_SubForm();
     $subform->setLegend(null);
     $testForm->addSubForm($subform, 'form3');
     $form = new Admin_Form_ActionBox($testForm);
     $links = $form->getJumpLinks();
     $this->assertEquals(2, count($links));
     $this->assertArrayHasKey('#fieldset-form1', $links);
     $this->assertEquals('Subform 1', $links['#fieldset-form1']);
     $this->assertArrayHasKey('#fieldset-form2', $links);
     $this->assertEquals('Subform 2', $links['#fieldset-form2']);
 }
Exemple #8
0
 /**
  */
 public function initForm(Zend_Form $form, ListView $list, MemberView $member = null)
 {
     $newsletter = new Zend_Form_SubForm();
     $newsletter->addElement('checkbox', 'subscriber', array('label' => 'I want to receive newsletter'));
     foreach ($list->groups as $group) {
         $type = $group['form_field'] == 'radio' ? 'radio' : 'multiCheckbox';
         $newsletter->addElement($type, $group['name'], array('label' => $group['name'], 'multioptions' => $group['groups']));
     }
     if ($member !== null) {
         $newsletter->setDefaults(array_merge((array) $member, $member->groups));
     }
     $form->addSubForm($newsletter, 'newsletter');
 }
Exemple #9
0
 /**
  * @group ZF-8494
  */
 public function testGetValidSubFormValues()
 {
     $data = array('sub' => array('valid' => 1234, 'invalid' => 'invalid', 'noElement' => 'noElement'));
     $subForm = new Zend_Form_SubForm();
     $validElement = new Zend_Form_Element("valid");
     $validElement->addValidator(new Zend_Validate_Int());
     $subForm->addElement($validElement);
     $invalidElement = new Zend_Form_Element('invalid');
     $invalidElement->addValidator(new Zend_Validate_Int());
     $subForm->addElement($invalidElement);
     $this->form->addSubForm($subForm, 'sub');
     $this->assertEquals(array('sub' => array('valid' => 1234)), $this->form->getValidValues($data));
 }
 /**
  * Jedem Language-Element in den Unterformularen wird ein Validator hinzugefügt. Formulare ohne Language-Element
  * werden ignoriert.
  */
 public function testPrepareValidation()
 {
     $form = new Zend_Form();
     $titleCount = 3;
     for ($index = 0; $index < $titleCount; $index++) {
         $subform = new Zend_Form_SubForm();
         $subform->addElement(new Application_Form_Element_Language('Language'));
         $form->addSubForm($subform, 'Title' . $index);
     }
     $subform = new Zend_Form_Subform();
     $subform->addElement('submit', 'Add');
     $form->addSubForm($subform, 'Actions');
     $instance = new Application_Form_Validate_MultiSubForm_RepeatedLanguages();
     $post = array('Title0' => array('Id' => '1', 'Language' => 'deu', 'Value' => 'Titel 1'), 'Title1' => array('Id' => '2', 'Language' => 'fra', 'Value' => 'Titel 2'), 'Title2' => array('Id' => '3', 'Language' => 'rus', 'Value' => 'Titel 3'), 'Actions' => array('Add' => 'Add'));
     $instance->prepareValidation($form, $post);
     for ($index = 0; $index < $titleCount; $index++) {
         $subform = $form->getSubForm('Title' . $index);
         $validator = $subform->getElement('Language')->getValidator('Application_Form_Validate_LanguageUsedOnceOnly');
         $this->assertNotNull($validator);
         $this->assertEquals($index, $validator->getPosition());
         $this->assertEquals(array('deu', 'fra', 'rus'), $validator->getLanguages());
     }
 }
Exemple #11
0
 /**
  * @group ZF-9540
  */
 public function testSubFormTranslatorPreferredOverDefaultTranslator()
 {
     $defaultTranslations = array('isEmpty' => 'Default message');
     $subformTranslations = array('isEmpty' => 'SubForm message');
     $defaultTranslate = new Translator('ArrayAdapter', $defaultTranslations);
     $subformTranslate = new Translator('ArrayAdapter', $subformTranslations);
     Registry::set('Zend_Translator', $defaultTranslate);
     $this->form->addSubForm(new SubForm(), 'subform');
     $this->form->subform->setTranslator($subformTranslate);
     $this->form->subform->addElement('text', 'foo', array('required' => true));
     $this->assertFalse($this->form->isValid(array('subform' => array('foo' => ''))));
     $messages = $this->form->getMessages();
     $this->assertEquals('SubForm message', $messages['subform']['foo']['isEmpty']);
     $this->assertFalse($this->form->isValidPartial(array('subform' => array('foo' => ''))));
     $messages = $this->form->getMessages();
     $this->assertEquals('SubForm message', $messages['subform']['foo']['isEmpty']);
 }
 public function editAction()
 {
     try {
         $model = $this->getModel();
         $dataForm = $this->getForm();
         $form = new Zend_Form();
         $form->addSubForm($dataForm, 'data');
         $form->addElement('submit', $this->view->translate('Save'));
         if ($this->_request->isPost()) {
             $postData = $this->_request->getPost('data');
             if ($dataForm->isValid($postData)) {
                 $this->view->messages = array();
                 $model->fromArray($postData);
                 $stored = $model->store();
                 if (!$stored) {
                     $dataForm->populate($postData);
                     $this->view->messages[] = array('level' => 'failure', 'message' => $this->view->translate('setup_message_write-failed'));
                 } else {
                     $this->view->messages[] = array('level' => 'notice', 'message' => $this->view->translate('setup_message_write-success'));
                     Zend_Translate::clearCache();
                 }
             } else {
                 $this->view->messages[] = array('level' => 'failure', 'message' => 'Es ist ein Fehler aufgetreten. Bitte überprüfen Sie Ihre Eingaben.');
             }
         } else {
             $formData = $model->toArray();
             $dataForm->populate($formData);
         }
         $this->view->form = $form;
     } catch (Setup_Model_FileNotReadableException $exc) {
         $this->_redirectTo('error', array('failure' => $this->view->translate('setup_message_error_read-access', $exc->getMessage())));
     } catch (Setup_Model_FileNotWriteableException $exc) {
         $this->_redirectTo('error', array('failure' => $this->view->translate('setup_message_error_write-access', $exc->getMessage())));
     } catch (Setup_Model_FileNotFoundException $exc) {
         $this->_redirectTo('error', array('failure' => $this->view->translate('setup_message_error_filenotfound', $exc->getMessage())));
     }
     $this->render('edit', null, true);
 }
 /**
  * @see ZF-11504
  */
 public function testSubFormWithNumericName()
 {
     $subForm = new Zend_Form_SubForm(array('elements' => array('foo' => 'text', 'bar' => 'text')));
     $form = new Zend_Form();
     $form->addSubForm($subForm, 0);
     $form->addSubForm($subForm, 234);
     $form2 = clone $form;
     $this->assertEquals($form2->getSubForm(234)->getName(), 234);
     $this->assertEquals($form2->getSubForm(0)->getName(), 0);
 }
 /**
  * Explicitly removes and re-adds elements to the provided form to
  * ensure that the form re-builds the element order.
  *
  * Due to a bug this is required if the order of an element is
  * changed after the internal form index was created:
  * {@link http://framework.zend.com/issues/browse/ZF-9946}
  *
  * @param Zend_Form $form
  * @param array(Zend_Form_Element|Zend_Form|Zend_Form_DisplayGroup) $elements
  */
 protected function reAssignElements(Zend_Form $form, array $elements)
 {
     $elementsByType = $this->categorizeElements($elements);
     foreach ($elementsByType['elements'] as $element) {
         /* @var $element Zend_Form_Element */
         $form->removeElement($element->getName());
         $form->addElement($element);
     }
     foreach ($elementsByType['subForms'] as $subForm) {
         /* @var $subForm Zend_Form */
         $form->removeSubForm($subForm->getName());
         $form->addSubForm($subForm, $subForm->getName());
     }
     foreach ($elementsByType['displayGroups'] as $displayGroup) {
         /* @var $displayGroup Zend_Form_DisplayGroup */
         $form->removeDisplayGroup($displayGroup->getName());
         $form->addDisplayGroup($displayGroup->getElements(), $displayGroup->getName());
     }
 }
Exemple #15
0
 /**
  * Add a form group/subform
  *
  * @param  Zend_Form $form
  * @param  string $name
  * @param  int $order
  * @return Zend_Form
  */
 public function addSubForm(Zend_Form $form, $name = null, $order = null)
 {
     if (!$name) {
         $name = $form->getName();
     }
     $form->setParent($this);
     return parent::addSubForm($form, $name, $order);
 }
Exemple #16
0
    public function testClearingAttachedItemsShouldNotCauseIterationToRaiseExceptions()
    {
        $form = new Zend_Form();
        $form->addElements(array(
            'username' => 'text',
            'password' => 'text',
        ));
        $form->clearElements();

        try {
            foreach ($form as $item) {
            }
        } catch (Zend_Form_Exception $e) {
            $message = "Clearing elements prior to iteration should not cause iteration to fail;\n"
                     . $e->getMessage();
            $this->fail($message);
        }

        $form->addElements(array(
                 'username' => 'text',
                 'password' => 'text',
             ))
             ->addDisplayGroup(array('username', 'password'), 'login');
        $form->clearDisplayGroups();

        try {
            foreach ($form as $item) {
            }
        } catch (Zend_Form_Exception $e) {
            $message = "Clearing display groups prior to iteration should not cause iteration to fail;\n"
                     . $e->getMessage();
            $this->fail($message);
        }

        $subForm = new Zend_Form_SubForm();
        $form->addSubForm($subForm, 'foo');
        $form->clearSubForms();

        try {
            foreach ($form as $item) {
            }
        } catch (Zend_Form_Exception $e) {
            $message = "Clearing sub forms prior to iteration should not cause iteration to fail;\n"
                     . $e->getMessage();
            $this->fail($message);
        }
    }
Exemple #17
0
 /**
  * get all the custom external fields 
  */
 public static function getElements(Zend_Form $form, $section = "customers", $panel_id = null)
 {
     $attributeForm = new Zend_Form_SubForm();
     // Get the list field
     $fields = Doctrine_Query::create()->from('CustomAttributes ca')->andWhere("ca.section = ?", $section)->andWhere('ca.panel_id = ? OR ca.panel_id IS ?', array(intval($panel_id), null))->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     // Set the decorator
     $attributeForm->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     foreach ($fields as $field) {
         // Create the custom field
         $attributeForm->addElement($field['type'], $field['var'], array('filters' => array('StringTrim'), 'label' => $field['label'], 'decorators' => array('Composite'), 'class' => 'form-control'));
     }
     // Add the subform
     $form->addSubForm($attributeForm, 'attributes');
     return $form;
 }
 /**
  * Add user attributes subform to form
  *
  * @param  Zend_Form            $form
  * @param  Newscoop\Entity\User $user
  * @return void
  */
 private function addUserAttributesSubForm(Zend_Form $form, User $user)
 {
     $translator = \Zend_Registry::get('container')->getService('translator');
     $subForm = new Zend_Form_SubForm();
     $subForm->setLegend($translator->trans('User attributes', array(), 'users'));
     foreach ($user->getRawAttributes() as $key => $val) {
         $subForm->addElement('text', $key, array('label' => $key));
     }
     $subForm->setDefaults($user->getAttributes());
     $form->addSubForm($subForm, 'attributes');
 }
Exemple #19
0
 /**
  * @param Zend_Form $form
  * @param string $name
  * @param null $order
  * @return $this
  */
 public function addSubForm(Zend_Form $form, $name, $order = null)
 {
     parent::addSubForm($form, $name, $order);
     if ($this->_clear) {
         if (null !== $name && !empty($name) && !$form->isClear()) {
             $this->cleanSubForm($this->getSubForm($name));
         }
     }
     return $this;
 }
Exemple #20
0
 /**
  * @see ZF-3272
  */
 public function testRenderedSubFormDtShouldContainNoBreakSpace()
 {
     $this->assertSame('1.11.0dev', Zend_Version::VERSION);
     $subForm = new Zend_Form_SubForm(array('elements' => array('foo' => 'text', 'bar' => 'text')));
     $form = new Zend_Form();
     $form->addSubForm($subForm, 'foobar')->setView(new Zend_View());
     $html = $form->render();
     $this->assertContains('>&#160;</dt>', $html);
 }
 public function testPrepareValidationWithOtherElements()
 {
     $validator = new Application_Form_Validate_MultiSubForm_RepeatedValues('Value', 'testmessage', 'Language');
     $form = new Zend_Form();
     $subform = new Zend_Form_SubForm();
     $subform->addElement('text', 'Value');
     $form->addSubForm($subform, 'subform1');
     $subform = new Zend_Form_SubForm();
     $subform->addElement('text', 'Value');
     $form->addSubForm($subform, 'subform2');
     $post = array('subform1' => array('Language' => 'deu', 'Value' => 'Schlagwort 1'), 'subform2' => array('Language' => 'eng', 'Value' => 'Schlagwort 2'));
     $validator->prepareValidation($form, $post, null);
     $position = 0;
     foreach ($form->getSubForms() as $subform) {
         $element = $subform->getElement('Value');
         $this->assertTrue($element->getValidator('Application_Form_Validate_DuplicateMultiValue') !== false);
         $validator = $element->getValidator('Application_Form_Validate_DuplicateMultiValue');
         $this->assertEquals(array(array('deu', 'Schlagwort 1'), array('eng', 'Schlagwort 2')), $validator->getValues());
         $this->assertEquals($position++, $validator->getPosition());
         $messageTemplates = $validator->getMessageTemplates();
         $this->assertEquals('testmessage', $messageTemplates['notValid']);
     }
 }
Exemple #22
0
 /**
  * @group ZF-11831
  */
 public function testElementsOfSubFormReceiveCorrectDefaultTranslator()
 {
     // Global default translator
     $trDefault = new Zend_Translate(array('adapter' => 'array', 'content' => array(Zend_Validate_NotEmpty::IS_EMPTY => 'Default'), 'locale' => 'en'));
     Zend_Registry::set('Zend_Translate', $trDefault);
     // Translator to use for elements
     $trElement = new Zend_Translate(array('adapter' => 'array', 'content' => array(Zend_Validate_NotEmpty::IS_EMPTY => 'Element'), 'locale' => 'en'));
     Zend_Validate_Abstract::setDefaultTranslator($trElement);
     // Change the form's translator
     $form = new Zend_Form();
     $form->addElement(new Zend_Form_Element_Text('foo', array('required' => true, 'validators' => array('NotEmpty'))));
     // Create a subform with it's own validator
     $sf1 = new Zend_Form_SubForm();
     $sf1->addElement(new Zend_Form_Element_Text('foosub', array('required' => true, 'validators' => array('NotEmpty'))));
     $form->addSubForm($sf1, 'Test1');
     $form->isValid(array());
     $messages = $form->getMessages();
     $this->assertEquals('Element', @$messages['foo'][Zend_Validate_NotEmpty::IS_EMPTY], 'Form element received wrong validator');
     $this->assertEquals('Element', @$messages['Test1']['foosub'][Zend_Validate_NotEmpty::IS_EMPTY], 'SubForm element received wrong validator');
 }
Exemple #23
0
 /**
  * @group GH-319
  */
 public function testHasErrorsMethodShouldCheckAlsoSubForms()
 {
     // Init form
     $form = new Zend_Form();
     $subForm = new Zend_Form_SubForm();
     $element = new Zend_Form_Element_Text('foo');
     $subForm->addElement($element);
     $form->addSubForm($subForm, 'subForm');
     $element->markAsError();
     // Test form
     $this->assertTrue($form->hasErrors());
     $this->assertFalse($form->isValid(array('foo' => 1)));
     // Test element
     $this->assertTrue($element->hasErrors());
     $this->assertFalse($element->isValid(1));
 }
Exemple #24
0
    public function testCanValidatePartialNestedFormsWithElementsBelongingToArrays()
    {
        $form = new Zend_Form();
        $form->setElementsBelongTo('foobar');

        $form->addElement('text', 'firstName')
             ->getElement('firstName')
             ->setRequired(false);

        $form->addElement('text', 'lastName')
             ->getElement('lastName')
             ->setRequired(true);

        $subForm = new Zend_Form_SubForm();
        $subForm->setElementsBelongTo('foobar[baz]');
        $subForm->addElement('text', 'email')
                ->getElement('email')
                ->setRequired(true)
                ->addValidator('NotEmpty');

        $subSubForm = new Zend_Form_SubForm();
        $subSubForm->setElementsBelongTo('foobar[baz][bat]');
        $subSubForm->addElement('checkbox', 'home')
                   ->getElement('home')
                   ->setRequired(true)
                   ->addValidator('NotEmpty');

        $subForm->addSubForm($subSubForm, 'subSub');

        $form->addSubForm($subForm, 'sub')
             ->addElement('submit', 'save', array('value' => 'submit'));


        $data = array('foobar' => array(
            'lastName'  => 'Cow',
        ));
        $this->assertTrue($form->isValidPartial($data));
        $this->assertEquals('Cow', $form->lastName->getValue());
        $firstName = $form->firstName->getValue();
        $email     = $form->sub->email->getValue();
        $home      = $form->sub->subSub->home->getValue();
        $this->assertTrue(empty($firstName));
        $this->assertTrue(empty($email));
        $this->assertTrue(empty($home));

        $form->sub->subSub->home->addValidator('StringLength', false, array(4, 6));
        $data['foobar']['baz'] = array('bat' => array('home' => 'ab'));

        $this->assertFalse($form->isValidPartial($data), var_export($form->sub->subSub->home, 1));
        $this->assertEquals('1', $form->sub->subSub->home->getValue());
        $messages = $form->getMessages();
        $this->assertFalse(empty($messages));
        $this->assertTrue(isset($messages['foobar']['baz']['bat']['home']), var_export($messages, 1));
        $this->assertTrue(isset($messages['foobar']['baz']['bat']['home']['stringLengthTooShort']));
    }
 public function testNotGeneratingSubformErrorMarkupWrappingWhenNoErrors()
 {
     $form1 = new Zend_Form_SubForm();
     $form2 = new Zend_Form();
     $form2->addSubForm($form1, 'sub');
     $form2->setView($this->getView());
     $this->decorator->setElement($form2);
     $content = 'test content';
     $this->assertSame($content, $this->decorator->render($content));
 }
Exemple #26
0
 public function getForm($includeSubmit = false)
 {
     if ($this->_sessionForm instanceof Zend_Form) {
         $form = $this->_sessionForm;
     } else {
         $form = new Zend_Form();
         $form->setIsArray(true);
         $form->addElement('hidden', 'id');
         $form->addSubForm($this->campaign->getForm(), 'campaign');
         $form->addElement('text', 'date', array('label' => 'Date'));
         $form->addElement('text', 'description', array('label' => 'Description'));
         $form->addElement('text', 'synopsis', array('label' => 'Synopsis'));
         $form->addElement('text', 'tags', array('label' => 'Tags'));
         $this->_sessionForm = $form;
         $this->_populateForm();
         $form = $this->_sessionForm;
     }
     if ($includeSubmit) {
         $form->addElement('submit', 'submit');
     }
     return $form;
 }