-- wizardz <[EMAIL PROTECTED]> wrote
(on Tuesday, 05 February 2008, 12:43 PM -0800):
> I need create next html code
> <form>
> <table>
> <tr>
> <td>Label</td>
> <td><input type="text" name="test"></td>
> </tr>
> <tr>
> <td colspan=2><input type="submit"></td>
> </tr>
> </table>
> </form>
> Do I have a way to create this HTML using Zend_Form?
> Thank you for answers.
> Andriy
To render the form into a table:
$form->setDecorators(array(
'FormElements',
array('HtmlTag', array('tag' => 'table')),
'Form'
));
Plus, you'll need to ensure the elements and labels are in table data
and table rows:
$form->setElementDecorators(array(
'ViewHelper',
'Errors',
array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag'
=> 'td')),
array('Label', array('tag' => 'td')),
array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag'
=> 'tr')),
));
For your 'submit' button, you'll want to modify the decorators so the
submit spans both columns:
$form->submit->setDecorators(array(
array(
'decorator' => 'ViewHelper',
'options' => array('helper' => 'formSubmit')),
array(
'decorator' => array('td' => 'HtmlTag'),
'options' => array('tag' => 'td', 'colspan' => 2)),
array(
'decorator' => array('tr' => 'HtmlTag'),
'options' => array('tag' => 'tr')),
));
Enjoy.
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/