我想用Zend发布数组。
html表格:
<form id="form" class="form-container" action="<?php echo $this->form->getAction(); ?>" method="post" enctype="multipart/form-data">
<?php foreach ($this->projects as $item): ?>
<?php echo $this->form->time_on_project; ?>
<?php echo $this->form->comment; ?>
<?php endforeach; ?>
Zend表格:
$this->addElement('text', 'time_on_project[]', array(
'label' => 'Время(формат час:минуты):',
'required' => true,
'attribs' => array('class' => 'form-field', 'required' => 'required', 'placeholder' => 'Введите время в формате час:минуты'))
);
$this->addElement('textarea', 'comment[]', array(
'label' => 'Что сделано:',
'required' => false,
'attribs' => array('class' => 'form-field', 'style' => 'height: 100px')
));
之后,我的输入没有显示。怎么做对了? 谢谢你的帮助。
答案 0 :(得分:1)
$this->addElement('text', 'time_on_project', array(
'isArray' => true,
'value' => '237',
'label' => 'Время(формат час:минуты):',
'required' => true,
'attribs' => array('class' => 'form-field', 'required' => 'required', 'placeholder' => 'Введите время в формате час:минуты'))
'decorators' => Array(
'ViewHelper'
),
));