0

我想知道很长时间。我没有为 zend_form 找到正确的方法。我们如何在 zend_form 中将 td 添加到 tr 标签中?那么我们如何在zend框架中解决这个问题。请任何人帮助我。它看起来像下面的代码:

<table>
      <tr>
       <td><input type='checkbox' id='something'/></td>
       <td><img src='src'/></td>
       <td><input type='text' id='something'/></td>
       <td><input type='radio' group='justonegroup'/></td>
      </tr>
</table>

我的代码是这样的:

          $pollAdd->setDecorators(array('ViewHelper',
            array(array('data' => 'HtmlTag'), array('tag' => 'td')),
            array(array('emptyrow' => 'HtmlTag'), array('tag' => 'td',                 )),
array(array('row' => 'HtmlTag') , array('tag' => 'tr','id'=>'trRowAdd')))); 


    $this->setDecorators(array(
            'FormElements',
            array('HtmlTag' , array('tag' => 'table' , 'class' =>'formTable')),
            'Form'));
4

1 回答 1

1

使用发送表单setDecorators

就像是 ,

   $this->setElementDecorators(array(
                'viewHelper',
                'Errors',
                array(array('data'=>'HtmlTag'),array('tag'=>'td')),
                array('Label',array('tag'=>'td')),
                array(array('row'=>'HtmlTag'),array('tag'=>'tr'))

    ),array('firstname','lastname'));

表单本身将具有table如下所示的 html 标签,

 $form->setDecorators(array(
    'FormElements',
    array('HtmlTag', array('tag' => 'table')),
    'Form',
  ));
于 2012-08-08T11:22:53.820 回答