Zend Form Decorators for special table
how can i get this table from my ZEND_FORM?
<table>
<tr>
<th>label 1</th>
<th>label 2</th>
</tr>
<tr>
<td>form element 1</td>
<td>form element 2</td>
</tr>
</table>
This is what I have. But this is not correct.
$kinder_decorators = array(
'ViewHelper',
开发者_开发问答 'Errors',
array('Label', array('tag' => 'th')),
array(array('data' => 'HtmlTag'), array('tag' => 'td'))
);
Can anybody help please?
BR Matt
You will need to use a ViewScript decorator on the whole form I'm afraid. The ViewScript decorator offers more flexibility for more complex layouts of form elements.
See my answer here for a small example. If it's unclear, hit me up with a comment, and I'll expand a little on it here.
You can't achieve this type of structure . Since its not possible to wrap two different labels inside same row and two different form element inside another row . Your markup is incorrect btw you should be doing
<tr><td>label1</td><td>form element 1</td></tr>
<tr><td>label2</td><td>form element 2</td></tr>
$kinder_decorators = array(
'ViewHelper',
'Errors',
array(array('content' => 'HtmlTag'), array('tag' => 'td'))
array('Label', array('tag' => 'th')),
array(array('data' => 'HtmlTag'), array('tag' => 'tr'))
);
精彩评论