Runtime & Delivery

Last updated:

To display and execute forms, Formcentric requires client-side runtime files. These provide the form logic, widget components, and translations.

How these files are served and loaded depends on your chosen integration method:

  1. Direct delivery (Static / SDK): The runtime files are hosted as pre-built, unchanged scripts on your web server or CDN (either modularly split or as an all-in-one bundle).
  2. Application bundler (React / Vue): The runtime is included as an npm package and integrated into your application chunks via your build process (e.g., Vite, Webpack).

Choose the delivery path that matches your setup.

Direct delivery for Static integrations

The split client.js is a small entry module that imports client.core.js. The shared runtime loads widgets from components/ and languages from locales/. Publish both files and these directories from the same package build with their relative directory structure unchanged.

The default entry URL /form/client.js may be redirected. Relative imports are resolved against the final response URL. The entry module and dynamically loaded widgets then import the same client.core.js; using a different entry URL does not create a second shared runtime instance.

For deployments under a subpath, an unprefixed entry URL can remain in the embed configuration if the server redirects it to the complete runtime directory under the deployment prefix. The embed does not need to bypass this entry redirect.

Keep the URLs of the shared runtime and chunks consistent. If only individual imports are rewritten, or if the shared runtime is redirected while widgets import it via a different URL, duplicate module instances can occur. For versioned deployments, publish the complete runtime directory under a version prefix. For stable URLs, configure cache revalidation for all runtime files.

Hosting Example Configuration
A customer website embeds forms from a different delivery domain Supported if the delivery server allows cross-origin module requests for the entry module, shared runtime, and nested chunks. The website's hostname does not change the relative module URLs.
A CDN redirects /client/latest/client.js to /client/v42/client.js Supported. Publish client.core.js, components/, and locales/ alongside the final entry URL under /client/v42/.
A reverse proxy maps stored assets to a public prefix Provide the complete directory structure under this prefix. Internal rewrites preserve the public URLs. Redirects of the entry module are supported if the complete runtime directory is located at the final destination.

formapp.js is the fully bundled UMD compatibility entry point for existing integrations. The file includes all bundled widgets and languages and does not require runtime chunk directories. Older wrappers continue to load this file as a classic script.

The wrapper selects the runtime as follows:

  1. Without formappUrl, the wrapper loads /form/client.js from the base URL with type="module". Cross-origin module requests require CORS as well as a JavaScript Content-Type. By default, they do not send cross-origin credentials.
  2. formappUrl / data-fc-formapp-url selects the full classic formapp.js and is always loaded as a classic script, even with non-descriptive CMS media URLs. This option must not point to an ES module.
  3. formappUrl is deprecated for new cloud integrations; omitting it uses the default split runtime. Existing classic integrations remain supported.

Bundler integration

The Client SDK (@formcentric/client), as well as the React and Vue packages, each include the form runtime and import it dynamically when embedding a form. They do not load client.js from Delivery and do not accept formappUrl. The consuming application's bundler processes the included runtime along with its widget and language imports, generating its own chunk names and references. The React and Vue packages only require the client package for its theme assets.

Publish the complete application build, including all generated chunks. Configure the bundler's asset base URL or public path for the deployment directory or CDN. Do not separately load another unprocessed runtime alongside the bundled runtime. If the runtime is excluded from bundling and delivered unchanged, the requirements for direct delivery above apply.

Troubleshooting

Common sources of errors include:

  1. On editor.formcentric.com , the domain of the embedding page was not added under Profile → Admin centre → Security
  2. Wrong embedId
  3. Form is not yet published
  4. Domain is not activated in Formcentric
  5. Wrong srcUrl, dataUrl, formappUrl or designUrl
  6. Runtime, theme or templates are not loaded
  7. For Static, the defer attribute is missing on the formcentric.js script tag
  8. For SPA or SDK integration projects, a re-init is expected without re-mounting

Runtime loading errors

Check the browser console and the Network panel for the first blocked or failed script request. The wrapper manages the default runtime entry point and its dependencies; the requested files may change between releases. Proxies and self-hosted deployments must provide the complete published assets.

Symptom Resolution
The console reports a Content Security Policy (CSP) violation for client.js, client.core.js, or a chunk Add the origin or directory of the runtime assets to the script directive reported by the browser. An origin-based allowlist entry for https://form.formcentric.com covers its script paths; a directory entry with a trailing / covers subpaths. Policies that list individual script files must also allow the runtime dependencies upon an upgrade. Alternatively, you can use the full classic runtime described below.
A runtime request via a proxy or to self-hosted assets returns 404 Publish or completely proxy client.js, client.core.js, components/, and locales/ from the same package build, preserving their relative paths. Copying only formcentric.js and formapp.js does not provide the default split runtime. If the deployment only supports the full classic runtime, explicitly select it as shown below.
The console reports a CORS error for a module Configure the asset server or proxy to allow the origin of the embedding website for the entry module and all imported modules. Alternatively, serve the complete assets from the website's own origin or, for a script integration, use the full classic runtime described below.
The console reports an unsupported module MIME type, such as text/html Check the content and status of the response. Serve JavaScript with a JavaScript Content-Type such as text/javascript. Fix routes for missing files or SPA fallbacks that return HTML for runtime URLs.

Chunk loading is governed by the script directive and does not require an additional connect-src allowlist entry. However, form data requests remain subject to their respective connection requirements. Self-hosted assets are also subject to the website's CSP; their origin must be allowed.

For SDK, React, and Vue packages processed by a bundler, publish the complete application build and fix the bundler's asset base URL or public path. The generated chunk filenames may differ from the direct delivery filenames listed above. These packages use their included runtime; formappUrl does not select a different runtime for them.

Feedback

Selecting the Full Classic Runtime

For a script integration, set data-fc-formapp-url on the form container to the full classic formapp.js:


For self-hosted or CMS assets, replace these URLs with the published URLs of the wrapper and the full classic runtime. Existing CMS references to formapp.js can remain unchanged. This runtime includes all bundled widgets and languages and does not request any runtime chunks. Themes, captcha SDKs, and custom language modules remain separate assets.

Despite the formappUrl deprecation for new cloud integrations, the full classic runtime remains a supported compatibility option. Both its script URL and the wrapper URL must still be allowed by the CSP. Do not point this attribute to client.js, as that file must be loaded as a module.