type: mixeddefault: Defaults to field of the underlying object (if there is one)

When you create a form, each field initially displays the value of the
corresponding property of the form's domain object (if an object is bound
to the form). If you want to override the initial value for the form or
just an individual field, you can set it in the data option:

1
2
3

$builder->add('token','hidden',array('data'=>'abcdef',));

Note

The default values for form fields are taken directly from the underlying
data structure (e.g. an entity or an array). The data option overrides
this default value.

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.

Imagine you have a custom method named matchingCityAndZipCode that validates
whether the city and zip code match. Unfortunately, there is no "matchingCityAndZipCode"
field in your form, so all that Symfony can do is display the error on top
of the form.

With customized error mapping, you can do better: map the error to the city
field so that it displays above it:

Sets the HTML attributes for the <label> element, which will be used
when rendering the label for the field. It's an associative array with HTML
attribute as a key. This attributes can also be directly set inside the
template:

If true, the whitespace of the submitted string value will be stripped
via the trim function when the data is bound. This guarantees
that if a value is submitted with extra whitespace, it will be removed before
the value is merged back onto the underlying object.