php - Post multipart data with Zend Forms -
i want post arrays zend.
html form:
<form id="form" class="form-container" action="<?php echo $this->form->getaction(); ?>" method="post" enctype="multipart/form-data"> <?php foreach ($this->projects $item): ?> <?php echo $this->form->time_on_project; ?> <?php echo $this->form->comment; ?> <?php endforeach; ?>
zend form:
$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') ));
after that, inputs not displayed. how make right? help.
you 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' ), ));
Comments
Post a Comment