Prefilling fields
A field can start with a value taken from the logged-in website user or from a data object the page passes to the form, for example a customer’s name and email, or the product a request is about.
In Studio
Section titled “In Studio”Form editor > Build tab > select a field > Fill in from:
| Choice | Value comes from |
|---|---|
| Nothing | the field starts empty (default) |
| Logged-in user | the Symfony security user of the website (your frontend login), e.g. a Customer data object |
| Data object of the page | the object the template passes to pimkit_form() |
Property is the getter to call: email calls getEmail(), address.city calls getAddress() and
then getCity() (or the city key of an array). Up to five levels. Works for all fields with a value
except file uploads.
In the template
Section titled “In the template”{# A product page: the "product" field is filled from the product object #}{{ pimkit_form('product_inquiry', { object: product }) }}
{# Or set values directly, by field name. These win over the field's own source #}{{ pimkit_form('contact', { prefill: { topic: 'support', campaign: app.request.query.get('c') } }) }}The areabrick has no object to pass, so “Data object of the page” works where you render the form
with pimkit_form() in your own template.
How values are used
Section titled “How values are used”- Visible fields: the value is only a starting point. The visitor can change it, and after a failed submit the visitor’s own input is shown again.
- Hidden fields are sealed: their prefilled values are signed into the form (
_pk_prefill), and on submit the signed value replaces whatever the browser sent. A visitor cannot change them. A hidden field with a prefill source that arrives without a valid seal (e.g. from a headless client) is stored empty. - Dates are written as
YYYY-MM-DDfor date fields, true becomes a ticked checkbox, lists fill checkbox groups. Objects without a text form are skipped. Nothing found means the field starts empty. - Studio users (Pimcore backend accounts) never prefill: the preview shows the form empty.
Caching
Section titled “Caching”A form prefilled from the logged-in user is personal. Make sure pages with such a form are not served from a shared full-page or CDN cache to other visitors (check your Pimcore full page cache exclusions and CDN rules for logged-in users). Object and template values are the same for every visitor of the page, so those pages stay cacheable.