Form Types Reference

Version: 2.8
Edit this page

Warning: You are browsing the documentation for Symfony 2.8, which is no longer maintained.

Read the updated version of this page for Symfony 6.0 (the current stable version).

Form Types Reference

New in version 2.8

To denote the form type, you have to use the fully qualified class name - like TextType::class in PHP 5.5+ or Symfony\Component\Form\Extension\Core\Type\TextType. Before Symfony 2.8, you could use an alias for each type like text or date. The old alias syntax will still work until Symfony 3.0. For more details, see the 2.8 UPGRADE Log.

A form is composed of fields, each of which are built with the help of a field type (e.g. TextType, ChoiceType, etc). Symfony comes standard with a large list of field types that can be used in your application.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.