How can I customize the appearance of my forms using Zend_Form?
You're probably looking for decorators. All forms and form elements in Zend_Form use decorators to render their output.
How can I add extra HTML (such as a link) to my form element?
This can easily be done using decorators. For instance using the Description decorator. It is important to note though that you will need to turn off escaping for the output of the decorator:
Now, you can use the following to add extra HTML to the element:
Why do I get failures when I want to display a file element?
The file element needs a special file decorator. It is added per default by the file element. But when you set your own decorators you deleted the default ones. See this example:
But you have to use the file decorator instead of the ViewHelper for the file element. So you should use it like this:
How can I detect if a optional file has been uploaded or not?
When calling receive you will get true returned when you set a file element as not required. The reason is that you said "the file can be omitted, and that's ok for me". In this case receive will only then return false when there was a failure.
Still there are several ways to detect if a file has been uploaded or not:
Use isUploaded which returns a boolean
Use getFileName which returns null in this case (note that you must use the latest release for this behaviour)
Use getFileInfo which will have an empty 'file' key and the flag 'isUploaded' set to false