Embedding
Embedding the Aidbox Form Builder and Renderer into your application using web components.
Embedding Aidbox Form Builder and Renderer
You can embed the Builder and Renderer into your application or website using web components.
Builder allows users to create and manage forms directly within your application.
Renderer enables users to fill out forms within your application without leaving your platform.
Step 1: Include the Script
Step 2: Add the Component Tag
Step 3: Configure Attributes
The following attributes are available for the Builder and Renderer components. These attributes control various aspects of the form’s behavior and appearance, including the form’s layout, customization options, and integration with external systems.
form-id
(optional): The ID of the form to load. If not provided, the builder opens with a blank form.hide-back
,hide-save
,hide-publish
(optional): Hides respective buttons in the UI.disable-save
,disable-publish
(optional): Disables respective actions.hide-population
,hide-extraction
(optional): Hides respective functionalities.collapse-debugger
(optional): Collapses the debugging panel.hide-add-theme
,hide-edit-theme
,hide-save-theme
(optional): Controls theme-related UI elements.show-share
(optional): Shows the share button.language
(optional): Default language for the builder.translation-languages
(optional): Comma-separated list of allowed languages.base-url
(optional): The base URL of your Aidbox instance.style
(optional): Custom styling for the iframe.config
(optional): The configuration as a JSON string.delegate-alerts
(optional): Emits alert events instead of showing them in the UI.enable-fetch-proxy
(optional): Enables request interception for custom fetch behavior.theme
(optional): Theme settings as a JSON string.token
(optional): JWT token for authentication.disable-load-sdc-config
(optional): Disables automatic loading of SDC configuration.
Step 4 (Optional): Configure Requests Interception
Both components support intercepting network requests. This allows debugging or customization, such as modifying authentication headers or rerouting requests.
Enable request interception by setting the enable-fetch-proxy
attribute and defining a custom fetch
function:
For more complex use cases, such as attaching authorization headers or storing questionnaires locally, refer to the detailed interception guide.
Controlled Mode (Deprecated)
Controlled mode gives full manual control over loading, updating, and persisting a Questionnaire and QuestionnaireResponse at the application level. The system does not automatically save changes, so the developer must handle data flow and storage. Depending on the use case, making requests to the intended endpoints, as normal mode does, may still be necessary.
This approach is useful when custom validation is required, such as enforcing business rules that go beyond standard validation mechanisms. It is also beneficial when integrating with external systems, where the Questionnaire and QuestionnaireResponse are stored outside Aidbox or when working with multiple data sources. Additionally, it allows fine-grained control over how and when data is fetched, updated, or persisted, making it suitable for applications that need to manage state independently.
Controlled mode is deprecated in favor of request interception, as the latter provides full control over the component’s interaction with Aidbox, extending beyond just Questionnaire and QuestionnaireResponse.
Step 5: Enable Controlled Mode
To enable controlled mode, remove the form-id
attribute and specify the Questionnaire resource as a JSON string in the value
attribute.
Step 6: Listen Events
In controlled mode, event handling becomes more critical since the system does not automatically manage updates. Developers must listen for events like change, save, and submit to track modifications and persist data manually.
Below is an example of how to listen for change
event:
The following events are available for listening:
alert
: Emitted when an alert occurs.change
: Triggered when the form is modified.back
: Emitted when the back button is clicked.save
: Emitted when the form is saved.select
: Emitted when an item is selected.ready
: Emitted when the builder is loaded.
Last updated
Was this helpful?