使用zend decorator为zend表单创建一个错误的td

时间:2011-04-19 12:25:05

标签: php zend-form zend-decorators

我用装饰器创建了一个zend表单。我用过验证器。因此,当发生错误时,我想生成此代码:

<form enctype="application/x-www-form-urlencoded" action="add" method="post" Name="addfrm" class="textpos" Id="addfrm" name="">
<table align="center" class="tbcss" width="84%">
<tr>
<td align="right" valign="top" width="15%"><label for="cou_name" class="required">Country Name :</label></td>
<td class="element" width="100%" valign="top">
   <input type="text" name="cou_name" id="cou_name" value="" size="39" />
   <img class="imgpos" src="/zendf/public/images/help.gif"></img>
</td>
<td>
   <ul class="errors">
    <li>Country name is required.</li>
    <li>Please Enter character data in country name.</li>
   </ul>
</td>
</tr>
</table>
</form>

但实际上代码生成如下:

<form enctype="application/x-www-form-urlencoded" action="add" method="post" Name="addfrm" class="textpos" Id="addfrm" name="">
<table align="center" class="tbcss" width="84%">
<tr>
<td align="right" valign="top" width="15%"><label for="cou_name" class="required">Country Name :</label></td>
<td class="element" width="100%" valign="top">
   <input type="text" name="cou_name" id="cou_name" value="" size="39" />
   <ul class="errors">
     <li>Country name is required.</li>
     <li>Please Enter character data in country name.</li>
   </ul>
   <img class="imgpos" src="/zendf/public/images/help.gif"></img>
</td>
</tr>
</table>
</form>

我正在使用这个装饰器:

  

public $ textbox = array(       '视图助手',

array('Errors'),      
     

array(array('image'=&gt;'HtmlTag'),   array('tag'=&gt;'img','placement'=&gt;   '追加', '类'=&GT; 'imgpos', 'SRC'=&GT; '/ zendf /公共/图像/ help.gif')),

     

array(array('data'=&gt;'HtmlTag'),array('tag'=&gt;'td','class'=&gt;   '元素', '宽度'=&GT; '100%', 'VALIGN'=&GT; '顶部')),

array(array('closeLabel' => 'HtmlTag'),array('tag' => 'td', 'closeOnly' =>
     

true,'placement'=&gt; 'prepend')),

     

'标签',

     

array(array('openLabel'=&gt;'HtmlTag'),array('tag'=&gt;'td',   'openOnly'=&gt;真, '对准'=&GT; '右', 'VALIGN'=&GT; '顶部', '宽度'=&GT; '15%')),

array(array('row' => 'HtmlTag'), array('tag' => 'tr')), );

我希望在发生错误时,它会创建一个td并显示在其中。

任何人都可以帮助我。

1 个答案:

答案 0 :(得分:0)

请使用搜索按钮,已有解决方案

Zend Form Decorators Error in Table

相关问题