integer Field Type

Renders an input “number” field. Basically, this is a text field that’s good at handling data that’s in an integer form. The input number field looks like a text box, except that - if the user’s browser supports HTML5 - it will have some extra frontend functionality.

This field has different options on how to handle input values that aren’t integers. By default, all non-integer values (e.g. 6.78) will round down (e.g. 6).

Rendered as input text field
Inherited options
Parent type field
Class Symfony\Component\Form\Extension\Core\Type\IntegerType

Field Options


type: integer default: IntegerToLocalizedStringTransformer::ROUND_DOWN

By default, if the user enters a non-integer number, it will be rounded down. There are several other rounding methods, and each is a constant on the Symfony\Component\Form\Extension\Core\DataTransformer\IntegerToLocalizedStringTransformer:

  • IntegerToLocalizedStringTransformer::ROUND_DOWN Rounding mode to round towards zero.
  • IntegerToLocalizedStringTransformer::ROUND_FLOOR Rounding mode to round towards negative infinity.
  • IntegerToLocalizedStringTransformer::ROUND_UP Rounding mode to round away from zero.
  • IntegerToLocalizedStringTransformer::ROUND_CEILING Rounding mode to round towards positive infinity.


type: integer default: false

The value set as the NumberFormatter::GROUPING_USED attribute when using the PHP NumberFormatter class.

Inherited options

These options inherit from the field type:


type: Boolean default: true

If true, an HTML5 required attribute will be rendered. The corresponding label will also render with a required class.

This is superficial and independent from validation. At best, if you let Symfony guess your field type, then the value of this option will be guessed from your validation information.


type: string default: The label is “guessed” from the field name

Sets the label that will be used when rendering the field. The label can also be directly set inside the template:

{{ render_label(, 'Your name') }}


type: Boolean default: false

If this option is true, the field will be rendered with the disabled attribute so that the field is not editable.


type: Boolean default: false

If true, any errors for this field will be passed to the parent field or form. For example, if set to true on a normal field, any errors for that field will be attached to the main form, not to the specific field.



hidden フィールドタイプ


language Field Type





現在、翻訳が古くなっている箇所が多くあります。1箇所、1行などほんの少量でもかまいませんので、ドキュメント翻訳にご協力いただける方を募集しています。日本 Symfony ユーザー会メーリングリストまでご連絡ください。