views:

481

answers:

4

I am dealing with Zend_Form right now and am having a difficult time figuring out how to: 1. Use custom images for form buttons and, 2. Insert text and links in specific places (in my case I want to put a "forgot your password?" link before the submit button).

I've read through the manual but am not seeing anything about this. Any direction from stackoverflow folks?

+1  A: 

I think Zend_Form_Decorators may help you: http://framework.zend.com/manual/en/zend.form.decorators.html

A: 

You can write straight up HTML in your view, just make sure that the element names, select options, hidden values etc. correspond to your Zend_Form elements (or set the element decorators to just ViewHelper and use echo $this->form->element where the elements should be). It's just the same POST data anyway when you submit the form. If you're using the form in more than one place, check out the ViewScript decorator.

monzee
This works if I am generating the form directly in the view but what if I am subclassing Zend_Form and then using that to populate a view variable in my controller ($this->view->form = $_getForm)
gaoshan88
A: 
  1. CSS?
  2. You can use an element's setDescription() method to add a description to it. If I remember correctly, this renders into a 'p class="hint"' element, but you can of course change that using the form decorators.
bertbalcaen
+2  A: 

try to read also this article, I think it is the best one about decorators in Zend_Form

http://devzone.zend.com/article/3450-Decorators-with-Zend_Form

for your usage will be most helpful part about "Full Customization Using the ViewScript Decorator", try to find it in article

harvejs