Matthew,
I'm using setElementDecorators() to do something similar like the table
example, but it doesn't do anything at all? Is that feature enabled or not
yet?
$form->setElementDecorators(array(
'ViewHelper',
'Errors',
array('Label', array('tag' => 'dt', 'class' => 'register')),
array('HtmlTag', array('tag' => 'dd', 'class' => 'register'))
));
Thank you.
Matthew Weier O'Phinney-3 wrote:
>
> -- 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/
>
>
--
View this message in context:
http://www.nabble.com/How-render-Zend_Form-to-html-table--tp15299082s16154p16002312.html
Sent from the Zend Framework mailing list archive at Nabble.com.