Code-based Features
Code-based features let you extend forms-engine-plugin with custom TypeScript or JavaScript. Use them when configuration-based options aren't sufficient for your requirements — for example, to build a bespoke component, override a service, or add highly specialised page logic.
Only introduce code-based customisations where there is genuine business need. Custom code becomes your team's responsibility to test, maintain and keep accessible.
Custom Components
Build custom form components. Components can extend ComponentBase for display-only purposes or FormComponent to handle user input with validation, state management and rendering.
Custom Page Controllers
Attach bespoke server-side logic to a specific page. For example: running an auth check before render, enriching the view model with external data, or intercepting form submission.
Custom Services
Replace the default form-loading or submission behaviour by providing your own formsService, formSubmissionService or outputService implementations via the plugin registration options.
File Upload
Integrate CDP's cdp-uploader service to support accessible, progressively-enhanced file submissions within a form journey.
Page Views
Override the default Nunjucks templates for individual pages by configuring Vision to look in your own views directory before falling back to forms-engine-plugin's built-in templates.
Pre-populate State
Automatically copy query string parameter values into hidden fields on first load, allowing values to flow through a journey and on to submission without user interaction.
Save and Exit
Show a secondary "Save and exit" button on question pages and handle the persisted session using a route handler you supply, enabling users to leave and resume their journey later.
Template Extensions
Add custom globals and filters to the Nunjucks template environment, making them available across all form page templates and LiquidJS page templates.
Form Definition Formats
Options for loading form definitions — file-based loading with the built-in FileFormService, or a custom formsService implementation for API and database sources.
Session Cache
Configuring the server-side session store for production: named catbox cache or a custom CacheService subclass.