自定义Zend_Form

I am dealing with Zend_Form right now and I 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.

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

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.

  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.

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