0
我想要一個html表單,我可以在div中分組一些元素。我正在使用socialengine創建表單?如何在SocialEngine表單元素中附加或預先添加HTML標記?
我想要一個html表單,我可以在div中分組一些元素。我正在使用socialengine創建表單?如何在SocialEngine表單元素中附加或預先添加HTML標記?
經過長時間的研究,我得到了這個解決方案,可能對其他人有幫助。
class Mymodule_Form_Article_Filter extends Engine_Form{
public function init()
{
$request = Zend_Controller_Front::getInstance()->getRequest();
$this->setDescription('Find article which you want..');
$this->setAttrib('class', 'global_form_popup');
//create a form element
$this->addElement('Text', 'outcome', array(
'label' => 'Search Outcome',
'required' => false,
'value' =>$request->getParam('outcome'),
'class' => 'outcome-search'
));
// create submit element
$this->addElement('Button', 'submit', array(
'label' => 'Filter Articles',
'type' => 'submit',
'class' => 'outcome-search'
));
//wrapping to a div
$this->addDisplayGroup(array('outcome', 'submit'), 'searchGroup');
$group = $this->getDisplayGroup('searchGroup');
$group->setDecorators(array(
'FormElements',
array('HtmlTag', array('tag' => 'div', 'class' => 'full-length-search'))
));
}
}