I found the cause of the problem but not the solution. The problem is my
custom decorator is killing this feature. Following is my decorator. I
think the problem can be with the "buildInput" method.
Anyone can help?
Thanks
<?php
class Decorators_Composite extends Zend_Form_Decorator_Abstract implements
Zend_Form_Decorator_Marker_File_Interface
{
public function buildLabel()
{
$element = $this->getElement();
$label = $element->getLabel();
if ($translator = $element->getTranslator())
{
$label = $translator->translate($label);
}
/* Se o elemento for requerido, será adicionado um "*" após o seu
nome */
/*
if ($element->isRequired()) {
$label .= '*';
}
$label .= ':';
*/
return '<td>' .
$element->getView()->formLabel($element->getName(),
$label) .'</td>';
return $label;
}
public function buildInput()
{
$element = $this->getElement();
$helper = $element->helper;
return '<td>' . $element->getView()->$helper(
$element->getName(),
$element->getValue(),
$element->getAttribs(),
$element->options
).'</td>';
}
public function buildErrors()
{
$element = $this->getElement();
$messages = $element->getMessages();
if (empty($messages)) {
return '';
}
return '
<div class="errors">' .
$element->getView()->formErrors($messages) . '</div>';
}
public function buildDescription()
{
$element = $this->getElement();
$desc = $element->getDescription();
if (empty($desc)) {
return '';
}
return '<td class="description">' . $desc . '</td>';
}
public function render($content)
{
$element = $this->getElement();
if (!$element instanceof Zend_Form_Element) {
return $content;
}
if (null === $element->getView()) {
return $content;
}
/* Gera todos os códigos */
$separator = $this->getSeparator();
$placement = $this->getPlacement();
$label = $this->buildLabel();
$input = $this->buildInput();
$errors = $this->buildErrors();
$desc = $this->buildDescription();
/* Cria o elemento usando div */
$output = '<tr>';
$output .= $label . $input . $errors . $desc;
$output .= '</tr>';
switch ($placement) {
case (self::PREPEND):
return $output . $separator . $content;
case (self::APPEND):
default:
return $content . $separator . $output;
}
}
}
?>
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/setBelongsTo-doesn-t-work-tp2286743p2286768.html
Sent from the Zend Framework mailing list archive at Nabble.com.