This recipe involves different ways of creating forms, and after that we will talk about how elements are added to the form. In the last part of this recipe we will discuss how to validate forms, and the best way of accomplishing this.
A basic ZF2 skeleton application, with at least one module where we can work in, is necessary to create and output forms.
If we want to use form annotations, we also require
Doctrine\Common to be initiated in the skeleton as it has the parsing engine to parse the annotations. If we are using composer (which comes with the Zend Framework 2 skeleton) we can simply update our
composer.json by adding the following line to the required section:
Make sure the comma ...