DefaultValueSources
Introduction
DefaultValueSources define how a FormField receives a prefilled value when a form is rendered.
For forms, there are administration endpoints to create, update, and delete default value sources. Additionally, forms expose a runtime endpoint to resolve and return effective default values:
GET /api/forms/{form}/default-values
Get resolved default values for a form
Return the resolved default values for all form fields of a form.
Definition
GET /api/forms/{form}/default-values
Authorization
Requires access to the form (
showpermission on the form).Available for authenticated API users and permalink context.
Behavior
The endpoint resolves default values by processing the configured default value sources per field.
Sources are evaluated in
sort_numberorder per field.The first source that can be resolved for a field is returned.
If a source cannot be resolved (e.g. missing context data), it is skipped and the next source is tried.
Response data is keyed by
form_field_id.
Example Request
Example Response
Model Definition
Alias
defaultValueSource
Relations
[Adm.] Create
Create a new DefaultValueSource.
Definition
POST /api/administration/forms/fields/default-value-sources
Request Keys
source_type*
string
-
Source type. Allowed values: formFieldValue, systemVariable.
config
object
{}
Source-specific configuration.
source_entity_type
string | null
null
Morph alias for source entity. For forms this can be formField. Required with source_entity_id.
source_entity_id
integer | null
null
Source entity ID. Required with source_entity_type.
sort_number
integer
auto
Sort order within the same form_field_id.
Keys with * are required.
Source-specific config
configformFieldValueNo required config keys.
Typical usage: combine with
source_entity_type = formFieldandsource_entity_id = {formFieldId}.
systemVariablevariable_key(required, string), see system variables for more information on available variables and their keys.variable_filter(optional, string|null, expects a formatter key from System variable formatters)
Example Request
Example Response
[Adm.] Update
Update an existing DefaultValueSource by id.
Definition
PUT /api/administration/forms/fields/default-value-sources/{id}
Request Keys
source_type
string
New source type (formFieldValue, systemVariable).
config
object
Source-specific configuration.
source_entity_type
string | null
Morph alias for source entity (formField for forms).
source_entity_id
integer | null
Source entity ID.
sort_number
integer
Sort order within the same form_field_id.
Behavior notes
If
source_typeis not provided, the existing type is used for validation.If
source_typechanges andconfigis omitted, default config for the new type is applied before validation.If
form_field_idis changed, create-authorization is checked for the new target field.
Example Request
Example Response
[Adm.] Delete
Delete an existing DefaultValueSource by id.
Definition
DELETE /api/administration/forms/fields/default-value-sources/{id}
Example Request
Example Response
Last updated