Configuration

Last updated:

The full semantics for the Formcentric keys, the configuration source priority, and the arrangements for Static, SDK, React and Vue are listed in the main Formcentric Client General documentation.

This page therefore focuses on the following:

  1. The Static syntax for the common keys as data-fc-*
  2. Static-specific script tag attributes
  3. Static-specific use of window.formcentric

Form container attributes

Configuration in Static mode is primarily completed via data-fc-* attributes on the form container. All attribute values in HTML are strings at first. JSON-based values must therefore be passed as a JSON string.

The technical meaning of the following fields is given in the main Formcentric Client General documentation. This page only deals with the Static syntax.

Identification and form source

Static syntax Equivalent to Please note
data-fc-id Form ID / embedId Required locally if no form definition is being used
data-fc-form-definition Form definition / formDefinition Alternative to data-fc-id
data-fc-src-url srcUrl Can also be set browser-global as a default
data-fc-data-url dataUrl Can also be set browser-global as a default
data-fc-formapp-url formappUrl Can also be set browser-global as a default
data-fc-design-url designUrl Can also be set browser-global as a default

Request, language and metadata

Static syntax Equivalent to Please note
data-fc-vars vars JSON string, not browser-global
data-fc-params params JSON string, not browser-global
data-fc-refs refs Not browser-global
data-fc-token
token
Can also be set browser-global as a default
data-fc-request-headers requestHeaders JSON string with string values
data-fc-language
language
Can also be set browser-global as a default
data-fc-locale
locale
Can also be set browser-global as a default
data-fc-locales-path
localesPath
Can also be set browser-global as a default
data-fc-name Formularname / formName Not browser-global
data-fc-instance-id instanceId Not browser-global
data-fc-content-handler
contentHandler
Can also be set browser-global as a default
data-fc-env
env
Can also be set browser-global as a default
data-fc-parent-url
parentUrl
Can also be set browser-global as a default
data-fc-configuration configuration JSON string, object values are combined together with defaults


Important for data-fc-vars:

  1. URL parameters are also taken into account in the initialisation request.
  2. If both data-fc-vars and a URL parameter contain the same key, then the URL parameter overrides the value from data-fc-vars.

Theme and assets

Static syntax Equivalent to Please note
data-fc-theme-dir
themeDir
Can also be set browser-global as a default
data-fc-theme
theme
Can also be set browser-global as a default
data-fc-theme-url
themeUrl
Can also be set browser-global as a default
data-fc-theme-variable-url
themeVariableUrl
Can also be set browser-global as a default
data-fc-template-url
templateUrl
Can also be set browser-global as a default
data-fc-theme-variables
themeVariables
JSON string, object values are combined together with defaults
data-fc-skip-theme-load skipThemeLoad Only relevant if set explicitly
data-fc-skip-templates-load skipTemplatesLoad Only relevant if set explicitly
data-fc-skip-form-load skipFormLoad Advanced option



Note on theme behaviour:

  1. A local theme is only treated internally as a local theme if either data-fc-theme-dir and data-fc-theme are both set or data-fc-theme-url and data-fc-theme-variable-url are both set.
  2. For templates, either data-fc-template-url or the combination of data-fc-theme-dir and data-fc-theme are also required.

Layout and debugging

Static syntax Equivalent to Please note
data-fc-max-width
maxWidth

Can also be set browser-global as a default
data-fc-height
height
Can also be set browser-global as a default
data-fc-debug
debug
Can also be set browser-global or on the script tag
data-fc-watch
Static only
Monitors attribute changes on the container

Script tag configuration

On the script tag itself, additional Static-specific controls are evaluated:

Attribut Equivalent to Please note
data-fc-debug="true" debug Static-specific syntax directly on the script tag
data-fc-dynamic-init="true" dynamicInit Static only, automatic initialisation of newly added containers

Example:


Global configuration via window.formcentric

The available browser-global default keys are not primarily Static-specific. The same default values are also evaluated by the SDK, and therefore indirectly by React and Vue. Direct work with window.formcentric is Static-specific, however.

Mechanisms

Mechanism Typical usage Description
Direct mutation of window.formcentric
Static, SDK, React, Vue
Sets browser-global defaults directly on the window object. This approach works even before loading formcentric.js.
window.formcentric.configure({...})
Static after loading formcentric.js Validates the browser-global defaults as passed and replaces the preconfigured default values.
configure({...}) from @formcentric/client
SDK, React, Vue
Functionally equivalent to window.formcentric.configure({...}), but is imported directly from the client package in module-based integration projects.

Priority and behaviour

The common priority, merge semantics and the list of browser-global default keys are described in the mainFormcentric Client General documentation.

For Static, the following also applies:

  1. data-fc-* attributes on the container override browser-global defaults.
  2. dynamicInit is a Static-only extension.
  3. Changes to browser-global defaults also take effect in the Static path only after a new initialisation or a re-initialisation.

Available browser-global default keys

The full list of the common browser-global default keys is given in the main Formcentric Client General documentation.

In the Static path, dynamicInit is also available as a Static-only extension.

Window API for Static

API Description
window.formcentric.initFormcentric() Initialises all currently available Static containers.
window.formcentric.stopAll() Stops all running instances.
window.formcentric.unmountAll() Unmounts all running instances.
window.formcentric.getInstance(embedId) Returns the current instance for an embedId.
window.formcentric.setInstanceOptions(embedId, options)
Sets instance-specific options for a given embedId before initialisation. This is ignored in the code if the instance is already running.

Example for browser-global defaults before loading the script:


Example for validated browser-global defaults after loading the script:


Parent URL/double opt-in

The technical semantics of parentUrl are described in Formcentric Client Generall. In the Static path, the same common key is set as the attribute data-fc-parent-url.

Wenn data-fc-parent-url nicht gesetzt ist, verwendet der Client standardmäßig window.location.href.

Beispiel:


Preconfiguring forms with dynamic values

The technical semantics of vars and the common behaviour with URL parameters are described in Formcentric Client General. In the Static path, the common key is set as the attribute data-fc-vars.

Set value with URL parameter

Example:


On loading the form, the URL parameter is applied to the initialisation variables.

Set value with configuration attribute


Including your own translations

The common semantics of localesPath and the structure of the translation file are described in Formcentric Client General. In the Static path, this common key can either be set locally via data-fc-locales-path or browser-global via window.formcentric.localesPath.

The file must be provided as a JavaScript module and be exported via export default.

Example:


Example for a localisation file:


Feedback