Reputation: 3433
Basically i want a form that can show users default set of templates and upload image also if user wants to upload his own image. Something like this:
How do i achieve this in Zend? So far i have tried creating a template form class
class application_forms_FormTemplate extends Zend_Form{
public function init()
{
$image = new Zend_Form_Element_Image('image', array('src' =>'/path/to/dock.jpg'));
$template = $this->createElement('radio','tygTemplate');
$template->addMultiOptions(
array(
'desert.jpg' => $image,
'dock.jpg' => 'something'
)
)
->setSeparator('');
$this->addElements(array(
$template,
//$image
));
}}
when i call this form in the view, i get the radio buttons but image is not rendered beside the radio.
Is there anything i am doing wrong or Could anyone point me to a better solution? Thank you.
Upvotes: 0
Views: 174
Reputation: 20726
I cant test it in the moment, but may be an problem with Zend Form (escaping by default), please try this:
$template = new Zend_Form_Element_Radio('template', array('escape' => false));
$template->addMultiOptions(array(
'xxx.jpg' => $image,
));
Upvotes: 1