Caution This chapter describes the way forms were implemented in symfony 1.0. For compatibility reason and because of the admin generator feature still uses this system, this information is also valuable for symfony 1.1. However, if you start a new project with symfony 1.1, you also want to read the "symfony Forms in Action" book for more information on the new form framework.

When writing templates, much of a developer's time is devoted to forms. Despite this, forms are generally poorly designed. Since much attention is required to deal with default values, formatting, validation, repopulation, and form handling in general, some developers tend to skim over some important details in the process. Accordingly, symfony devotes special attention to this topic. This chapter describes the tools that automate many of these requirements while speeding up forms development:

  • The form helpers provide a faster way to write form inputs in templates, especially for complex elements such as dates, drop-down lists, and rich text.
  • When a form is devoted to editing the properties of an object, the templating can be further accelerated by using object form helpers.
  • The YAML validation files facilitate form validation and repopulation.
  • Validators package the code required to validate input. Symfony bundles validators for the most common needs, and it is very easy to add custom validators.