How to make a composite Zend Form Element that includes a Dojo Field
Posted
by Joe
on Stack Overflow
See other posts from Stack Overflow
or by Joe
Published on 2010-04-13T14:38:21Z
Indexed on
2010/04/13
14:43 UTC
Read the original article
Hit count: 301
I used the zendcast video to get me this far. The form is properly displayed. However, I need to change the display order box into a number box of zend dojo type. I cannot figure it out. Even help with examples would be great.
<?php
class My_View_Helper_CategoryDetailElement
extends Zend_View_Helper_FormElement
{
protected $html = '';
public function CategoryDetailElement($name, $value = null, $attribs = null)
{
$type = $description = $displayOrder = $time = '';
if($value)
{
$type = $value->type;
$description = $value->description;
$displayOrder = $value->displayOrder;
$time = $value->time;
}
$helper = new Zend_View_Helper_FormText();
$helper->setView($this->view);
$helper_label = new Zend_View_Helper_FormLabel();
$helper_label->setView($this->view);
$helper_select = new Zend_View_Helper_FormSelect();
$helper_select->setView($this->view);
$helper_textarea = new Zend_View_Helper_FormTextarea();
$helper_textarea->setView($this->view);
$this->html .= $helper_label->formLabel($name . '[type]', 'Type: ', array());
$this->html .= $helper_select->formSelect($name . '[type]', $type, array(), array('individual'=>'individual', 'team'=>'team'));
$this->html .= "<br />";
$this->html .= $helper_label->formLabel($name . '[description]', 'Description: ', array());
$this->html .= $helper_textarea->formTextarea($name . '[description]', $description, array());
$this->html .= "<br />";
$this->html .= $helper_label->formLabel($name . '[displayOrder]', 'Display Order: ', array());
$this->html .= $helper->formText($name . '[displayOrder]', $displayOrder, array());
$this->html .= "<br />";
$this->html .= $helper_label->formLabel($name . '[time]', 'Time: ', array());
$this->html .= $helper->formText($name . '[time]', $time, array());
return $this->html;
}
}
?>
© Stack Overflow or respective owner