I think it’s important to start out with the purpose of the Zend Form component. Often, I run into developers who look at Zend Form as a giant helper class. They don’t distance the concept of the logic and the view. In fact, Zend Form is really a complete HTML form generation package, complete with separate logic and views.
The purpose of the logical part of Zend Form is to process input. If you really dissect the methods, you’ll notice that most (if not all) do not rely on the actual submission of a form. Simply, they accept an input and “run” the form based on that. Notice I said “run” and not render. For example, when you call isValid() you are executing the form logic. Generally, people will send in Zend_Http_Request::getPost() or something like that. However, you could easily parse an array from an incoming REST submission, an array representation of another object, or any number of sources.
The purpose of the view component of the Zend Form is to develop a quick way of rendering the output of a created/processed form object. These views come with the form, but are not required. We can set our own views if we really want to. But more on that later…
As it turns lout, later isn’t that much farther down the page. This isn’t a long-form tutorial, more of a quick hit. Aaron gives you both the HOW and the WHY in a very no-nonsense blog post. Don’t worry, there’s code that you can cut-n-paste if you just want the answer (You probably looked in the back of the book for answers in grade school as well, didn’t you.)
Zend_Form is one of the more complex and difficult components in Zend Framework 1 and as such, it’s always good to see someone showing others what they’ve learned. Drop by Aaron’s blog and give the post a read. make sure you leave him a comment if you like what you read.