views:

61

answers:

1

Hello. I have some zend form. It is my code:

private function _createForm($action) {

    $form = new Zend_Form();

    $form->setName($action . '_form');
    $form->setMethod('post');

    // Main tab
    $title = $form->createElement('text', 'title');
    $title->setLabel('Title')
          ->setAttrib('maxlength',50)->setAttrib('id', 'title')->setAttrib('class', $action . '_title')
          ->setAttrib('style','height: 15px; width: 200px;')
          ->setRequired(true)
          ->setDecorators(array(
            'ViewHelper',
            array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class'  => 'element')),
            array('Label', array('tag' => 'td')),
            array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
          ));

    $description = $form->createElement('textarea', 'description');
    $description->setLabel('Description')
                ->setAttrib('style','height: 50px; width: 200px;')->setAttrib('id', 'description')->setAttrib('class', $action . '_description')
                ->setDecorators(array(
                  'ViewHelper',
                  array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class'  => 'element')),
                  array('Label', array('tag' => 'td')),
                  array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
                ));
    // Advanced tab
    $qualif_time = $form->createElement('text', 'qualif_time');
    $qualif_time->setLabel('Qualification Time')
        ->setAttrib('maxlength',11)->setAttrib('id', 'qualif_time')->setAttrib('class', $action . '_qualif_time')->setAttrib('style','height: 15px; width: 200px;')
        ->setDecorators(array(
          'ViewHelper',
          array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class'  => 'element')),
          array('Label', array('tag' => 'td')),
          array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
        ));
    $total_assoc_down = $form->createElement('text', 'total_assoc_down');
    $total_assoc_down->setLabel('Total Associates Downline')
        ->setAttrib('maxlength',11)->setAttrib('id', 'total_assoc_down')->setAttrib('class', $action . '_total_assoc_down')->setAttrib('style','height: 15px; width: 200px;')
        ->setDecorators(array(
          'ViewHelper',
          array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class'  => 'element')),
          array('Label', array('tag' => 'td')),
          array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
        ));

    $submit = $form->createElement('submit', $action);
    $submit->setAttrib('id', 'submit')->setAttrib('value', $action)
           ->setDecorators(array(
             'ViewHelper',
             array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class'  => 'element')),
             array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
           ));

    $form->addElements(array(
        $title, $description, $qualif_time, $total_assoc_down
    ));

    $form->addDisplayGroup(array('qualif_time', 'total_assoc_down'), 'advanced_tab');
    $advanced_tab = $form->getDisplayGroup('advanced_tab');
    $form->addElements(array($advanced_tab, $submit));

    $form->setDecorators(array(
        'FormElements',
        array('HtmlTag', array('tag' => 'table')),
        'Form',
    ));
    return $form;
}

My task is to placing $title and description in one div, and placing $total_assoc and $qualif_time in other div. And I should insert href(link) before this divs. I tried to do it with addDisplayGroup(), but it creates a fieldset. I need div.

Thx.

A: 

Yes. it is work.

Alexander.Plutov