2009年3月6日星期五

Re: [fw-mvc] [ZF 1.7] [Zend_Form] Header for a table

Hi,

It seems almost impossible to do it with default decorators.
But there is a way of doing this.

1. make a copy of Zend_Form_Decorator_FormElements
2. customize it
3. add this Decorator and tr wrapper decorator before FormElements

The customize point is this.
Seek the row
> $items[] = $item->render();
in Zend_Form_Decorator_YourFormElements::render()

For example:

$decorator = new Zend_Form_Decorator_Label();
$items[] = $decorator->setElement($item)->render('');
// $items[] = $item->render();

It's not exactly that simple in practical use.
Excuse me. This is only sample.

This allows you to make a label listed Row.

Thanks

--
Tomoaki Kosugi
kipspro@gmail.com

2009/3/7 lesquale <cedbourgeon@hotmail.com>:
>
> Hi,
>
> Through my code, i create a form of which elements are displayed with a
> table, thanks to the decorators
> This part works just fine.
>
> I did it like :
> the form is inside <form> and <table> tags
> each line of the form is a subform, inside <tr> tags
> and each element of subforms is inside <td> tags
>
>
> What i would like to do know is to add a line :
> <tr>
> <th> col1 name</th>
> <th> col2 name</th>
> </tr>
>
> {and if names of colons could be labels of elements of a line, it would be
> just perfect - in fact, elements are the same type for each line [create via
> loop for]}
>
> i tried to do some changes in the decorators but it didn't work
>
> So if one of you got an advise or an idea, it will be really welcome
>
> Cedric.
> --
> View this message in context: http://www.nabble.com/-ZF-1.7---Zend_Form--Header-for-a-table-tp22375408p22375408.html
> Sent from the Zend MVC mailing list archive at Nabble.com.
>
>

没有评论: