public function prepareElements() { // add() can take either an Element/Fieldset instance, // or a specification, from which the appropriate object // will be built. $translator = Utility::translate(); $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'company', 'options' => array('label' => $translator->translate('Company')), 'attributes' => array('type' => 'text', 'class' => 'input-xlarge'))); $this->add(array('name' => 'name', 'options' => array('label' => $translator->translate('Name')), 'attributes' => array('type' => 'text', 'class' => 'input-xlarge'))); // $this->add(array( // 'name' => 'supply_for', // 'options' => array( // 'label' => $translator->translate('Supply for'), // ), // 'attributes' => array( // 'type' => 'text', // 'class' => 'input-xlarge' // ), // )); $supArray = Utility::getAllSuplyItemsArray(); $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('multiple' => 'multiple'), 'name' => 'supply_for', 'options' => array('label' => $translator->translate('Product'), 'value_options' => $supArray))); $this->add(array('name' => 'phone', 'options' => array('label' => $translator->translate('Phone')), 'attributes' => array('type' => 'text', 'class' => 'input-xlarge'))); $this->add(array('name' => 'mobile', 'options' => array('label' => $translator->translate('Mobile')), 'attributes' => array('type' => 'text', 'class' => 'input-xlarge'))); $this->add(array('name' => 'email', 'options' => array('label' => $translator->translate('Email')), 'attributes' => array('type' => 'text', 'class' => 'input-xlarge'))); $this->add(array('name' => 'addr', 'options' => array('label' => $translator->translate('addr')), 'attributes' => array('type' => 'textarea', 'class' => 'input-xlarge'))); $this->add(array('name' => 'send', 'attributes' => array('type' => 'submit', 'value' => $translator->translate('Save')))); // We could also define the input filter here, or // lazy-create it in the getInputFilter() method. }
public function prepareElements() { $translator = Utility::translate(); $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden'))); $this->add(array('name' => 'name', 'options' => array('label' => $translator->translate('Name')), 'attributes' => array('type' => 'text', 'class' => 'input-xlarge'))); $this->add(array('name' => 'quantity', 'options' => array('label' => $translator->translate('Quantity')), 'attributes' => array('type' => 'text', 'class' => 'input-xlarge'))); $supArray = Utility::getAllSuplyItemsArray(); $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'attributes' => array('id' => 'supplierItemId'), 'name' => 'supplierItemId', 'options' => array('label' => $translator->translate('Supplier item'), 'value_options' => $supArray, 'selected' => true))); $this->add(array('name' => 'supplierItemName', 'options' => array('label' => $translator->translate('Supplier Item Name')), 'attributes' => array('type' => 'text', 'class' => 'input-xlarge', 'id' => 'supplierItemName', 'readonly' => 'readonly'))); $this->add(array('name' => 'note', 'options' => array('label' => $translator->translate('Note')), 'attributes' => array('type' => 'textarea', 'class' => 'input-xlarge'))); $this->add(array('name' => 'time', 'options' => array('label' => $translator->translate('Time')), 'attributes' => array('type' => 'text', 'class' => 'input-xlarge date-picker'))); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => $translator->translate('Save'), 'id' => 'submitbutton', 'class' => 'btn btn-primary span3 typeahead'))); }