robjmills
robjmills

Reputation: 18598

HTML snippet within Zend_Form

I'm using Zend_Form as part of a simple signup process. In part 1 of 2 the user is able to upload a number of images. In part 2 - for each one of these images - I ask the user to add further details - an additional 4 text fields grouped together using addDisplayGroup. Within each display group I want to display a thumbnail of the uploaded image. I have generated these thumbs and all the processing is complete but i'm unsure what the best approach is for displaying the image within the relevant section. I guess its possible to create a custom form element to display this but somehow this feels like overkill considering the image is purely being used for display purposes. I also dont really want to replace $this->form->render() with a manual outputting of the form. Could this be achieved with a decorator maybe? I'm still fairly new to ZF so any ideas would be much appreciated.

Thanks.

Upvotes: 1

Views: 701

Answers (2)

jhogendorn
jhogendorn

Reputation: 6140

You would use a custom decorator in your decorator stack for the display group. Or you could use the HtmlTag decorator.

http://framework.zend.com/manual/en/zend.form.forms.html#zend.form.forms.displaygroups

Upvotes: 1

homelessDevOps
homelessDevOps

Reputation: 20726

there is an excelent example for an Custom image "Preview" Element:

Zend Form with Image

Or try the Zend_Form_Element_Image shipped with the Framework

Zend Form Element Image

Upvotes: 1

Related Questions