2

我想用 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')
        ));

之后,我的输入没有显示。如何使它正确?感谢帮助。

4

1 回答 1

1

you could try doing:

$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'
        ),
));
于 2013-05-15T09:21:39.147 回答