For example:
$assignment_type = $this->createMyElement('text', 'assignment_type', array(
'name' => 'assignment_type',
'id' => 'assignment_type_label'
))->setAttrib('maxlength', '100')->addDecorator('Htmltag', array('tag' => 'div', 'class' => 'input_text'));
Here I am creating an input wraped by div tag, but how can I add other element inside this div?
So I want to see something like this:
<div>
<input />
<img /> <!--the brother element created -->
</div>
Is that possible? or what hacks I need to use?
Here's how I did it to wrap three elements in one div (a date picker in this case):
$bday = new Zend_Form_Element_Select('bday');
$bday->setLabel('Birth Date: ')
->setDecorators(array(
array('ViewHelper'),
array('Label', array('tag' => 'dt')),
array('HtmlTag', //opening tag
array(
'tag' => 'div',
'openOnly' => TRUE,
'id' => 'bday',
'placement' => 'prepend'
)),
));
$bdaymonth = new Zend_Form_Element_Select('bdaymonth');
$bdaymonth->addValidator('Digits')
->setDecorators(array(
array('ViewHelper')
));
$bdayyear = new Zend_Form_Element_Select('bdayyear');
$bdayyear->addValidator('Digits')
->setDecorators(array(
array('ViewHelper'),
array('HtmlTag', //closing tag
array(
'tag' => 'div',
'closeOnly' => TRUE
)),
)); //elements truncated for brevity
I hope this gives you some ideas.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.