Я работаю над приложением, в котором пользователи могут быть размещены в группе. Группы могут быть добавлены / отредактированы в базе данных, поэтому они являются динамическими. У меня есть следующая форма:
public function init()
{
$this->setMethod('post')
->setAttrib('id', 'userGroup');
//get the stuff out of the db
$group = new Application_Model_GroupMapper();
$disciplines = $group->fetchAll(array(
'type' => 'discipline',
'orderby' => 'g.name',
'sort' => 'ASC'
));
$disciplineFields = array();
foreach($disciplines as $row):
$el = $row->name;
$this->addElement('checkbox', $el, array(
'required' => false,
'label' => $el,
'class' => 'inputCheckbox'
));
$this->$el->setCheckedValue('true');
$this->$el->setUnCheckedValue('false');
array_push($disciplineFields,$el);
endforeach;
//discipline information
$this->addDisplayGroup(
$disciplineFields,
'disciplineInformation',
array('legend' => 'Discipline')
);
НО Я получаю ошибку:
Не указаны допустимые элементы для группы отображения
Ну, это странно, потому что, когда я считаю свой массив $ schollineFields , он имеет 4 элемента, и поля выводятся при удалении строки displayGroup. Также, когда я изменяю строку displayGroup на
//discipline information
$this->addDisplayGroup(
array('Schipper'), //this is one of the records in the database
'disciplineInformation',
array('legend' => 'Discipline')
);
Поле 'Schipper' отображается в fieldset / displayGroup.
Почему это не работает? Что я делаю не так?