Enterprise Form Builder Module
Last updated
Was this helpful?
Last updated
Was this helpful?
The Form.io Enterprise Form Builder Module is a form building and form management utility that is completely embeddable within an application. This decouples the form building and form management functions from application development. It is analogous to the function of the Form.io Developer Portal, however the Enterprise Form Build Module functions entirely within the application environment.
When the form builder and manager is deployed within an application through the Enterprise Form Builder Module, the module implements custom routing to attach any created forms to a project. The forms can then be managed both through with the module's own form management tools as well as by accessing that project through the Form.io Developer Portal.
The embedded form builder and manager experience can be customized to the application context. The components and functionality can be configured to limit form builders within the application to certain components or to customize the behavior of components.
The Enterprise Form Builder Module supports a wide range of embedded Form.io Enterprise features, such as:
Manage Forms: Create, List, Edit, and Delete forms.
Form Edit conflict resolution: Multiple builders can safely modify the same form at once.
Routing logic and guards: Prompt a form user with unsaved changes before navigating away from a modified form.
Integrated Premium Components
Custom Form Builder configurations
Fully customizable components and route resolvers
The Enterprise Form Builder provides pre-defined modules that serve as a scaffold for embedding form building and form management functions in an application. It accomplishes this by introducing the routing logic, resolvers, and components that are used for the common CRUD operations used when managing forms. For a complete list of modules, refer to the Components section of this document.
The Enterprise Form Builder Module exists entirely within an applicaation external to the Form.io Platform. The following section will describe the process of embedding the Enterprise Form Builder into an application.
Before proceeding, ensure the following have been completed:
The Form.io Platform has been deployed and is operational.
A Project has been created that will be used to store forms created within the Enterprise Form Builder Module.
A library license for the Enterprise Form Builder Module has been issued.
The Enterprise Form Builder Module requires the NgModule method of Angular application structure.
When creating a new Angular application, provide the following configuration to ensure it uses the NgModule method:
Use one of the following terminal commands to install the @formio/enterprise-builder module into the application:
or
Install the framework-specific libraries as follows:
or
Set the license key with the following code snippet:
To configure the sample Angular application to use the Enterprise Builder Module, complete the following steps:
Create a configuration file in the format of EnterpriseBuilderConfig as shown below:
The following configurations can be provided to the Enterprise Builder Module:
license
The license for the Enterprise Form Builder module.
baseUrl
The URL for the Form.io Enterprise deployment.
https://forms.example.com
projectUrl
The Project URL to "mount" for form management within this application.
https://forms.example.com/myproject
tag
The tag to use when searching the forms in the Forms index.
common
icons
The icon class to use in the renderer.
bi - (for Bootstrap Icons)
config
An object of configurations to pass to the Formio.config SDK used to configure how the SDK operates.
showData
A boolean to enable the Submission management as part of the mounted form mangement routes and UI.
true - To show the submission management
Tell the application to use this configuration when mounting the module:
Set the FormioAppConfig service to use the extended EnterpriseBuilderAppConfig service, and then provide the ENTERPRISE_BUILDER_CONFIG token as follows:
or
Configure the application to use this theme with the following code:
Once the configurations and styles in place, the next objective is to set up User Authentication within the application.
User authentication is required to support form management within a project. These steps will configure the project to have a User role that will manage the forms.
From the Developer Portal, open the associated project.
Navigate to Access, then click New Role under the list of existing Project Roles.
Back on the Access page, configure permissions to add the Form Builder to the following Permission groups:
Create All
Read All
Update All
Delete All
Once the Form.io project is appropriately configured, configure authentication within the host application. For this step, please follow the following instructions:
With this route in place, application users can authenticate into the app and subsequently be authenticated into the Form.io Project with the appropriate privileges.
Once Authentication is in place, the next objective is to bind the Enterprise Form Builder Module alert system with the host application. By default, the Enterprise Form Builder Module uses a base service for when certain alerts are triggered within the EnterpriseBuilderAlerts service.
This example uses the ngx-toastr
module to add Toastr notifications to the application.
Install the module with the following commands:
or
Add the service to the module as follows:
Import the SCSS:
Create a new wrapper Service for the EnterpriseBuilderAlerts service, like so:
Extend this service from the EnterpriseBuilderAlerts, and hook it into the ToastrService as follows:
Provide this in the application as follows:
Now, any alerts triggered by the Enterprise Form Builder Module will show within the host application alert system using the Toastr module.
Next , "mount" the Form Management UI within the host application's routing system. This allows application users to navigate to a specific route within the application to see the Form Building UI provided by the Enterprise Form Builder Module. To do so, complete the following steps:
In Angular, use the @angular/router module for all routing for the Enterprise Form Builder Module. To accomplish this, complete the following steps:
Create a new Angular module that will encapsulate the forms module within the Enterprise Form Builder Module, using the following CLI command:
Mount the FormRoutes in the RouterModule within the FormsModule using the following code:
Mount this module within the routes using the app-routing.module.ts.
With the Enterprise Form Builder Module in place, navigate to the "forms" path within the host application (after authenticating) to see the full Form Building and Management UI as follows:
By default, only the Form Management UI components are enabled. To enable the Submission management UI inside of this module, provide the following within the configurations:
Once enabled, the following UI is now available within each Form context:
The Enterprise Form Builder Module includes many different Components, mounted at different routes, that can be configured and overridden by the application embedding the module. The following components are included at the following routes:
The following components are available. More detailed information about these components is included at the end of this document.
FormsComponent
Provides the index of forms.
:host
FormBuildComponent
The component used to create a new form, that shows the form builder.
:host/build
FormComponent
The wrapper component for all child route components within the Form context. This provides the navigation UI for the "view", "edit" "delete", "settings" tabs for a specific form.
:host/:formId
FormViewComponent
The component used to view (or use) a form.
:host/:formId/view
FormEditComponent
Used to edit a form, allowing the builder to edit the current Form JSON.
:host/:formId/edit
FormDeleteComponent
Confirms and processes Form deletion.
:host/:formId/delete
FormChangesComponent
Notifies a form user that a form has been changed when they attempt to navigate away from the form context. It allows them to go back to the form context, or discard the form changes.
:host/:formId/changes
FormConflictComponent
Shown to the user when a form conflict is identified between the form being saved to the server, and the form that already exists on the server, indicating that someone has already made changes to the form.
:host/:formId/conflict
FormSettingsComponent
Provides an interface to allow a user to modify the metadata for the current form such as the title, name, path, tags, etc.
:host/:formId/settings
FormSubmissionsComponent
Provides a view of the submissions for a form.
:host/:formId/submission
FormSubmissionComponent
The wrapper component for a Form Submission. Provides the navigation UI for the other child components such as view, edit, and delete. It also provides a button for downloading the submission as a pdf
:host/:formId/submission/:submissionId
FormSubmissionViewComponent
The component used to view an existing submission within a form.
:host/:formId/submission/:submissionId
FormSubmissionEditComponent
Used to allow the user to edit an existing submission.
:host/:formId/submission/:submissionId/edit
FormSubmissionDeleteComponent
The component that provides an interface to the user to delete a submission.
:host/:formId/submission/:submissionId/delete
Each component can be overridden when the Enterprise Form Builder Module is embedded within the application. The following process is an example of how to override one of the components for the framework:
To override the UI when a Form is being viewed, alter the FormViewComponent by extending it.
Create a new component within the form module using the CLI tool as follows:
This component can now extend the Enterprise Form Builder FormsViewComponent as follows:
Paste the code in the overridden view.component.html
like so:
Modify the component as needed, for example:
Tell the Enterprise Form Builder Module to use the modified component instead of the default FormViewComponent. Do this in the Forms module, where FormRoutes is mounted. This function takes a configuration; provide the form view component as follows:
Following a similar process, the following configurations can override any component within the Enterprise Form Builder Module:
The following components are available:
This component provides the index for the forms.
Route
:host
Code
Template
This component is used to create new forms in your application.
Route
:host/build
Code
Template
The wrapper component for all child route components within the Form context. This provides the UI for the navigation to the "edit", "settings", etc for a specific form.
Route
:host/:formId
Code
Template HTML
The component used to view (or use) a form.
Route
:host/:formId/view
Code
Template HTML
The component used to edit a form providing the builder to edit the current Form JSON.
Route
:host/:formId/edit
Code
Template HTML
Provides an interface to allow a user to modify the metadata for the current form in context such as the title, name, path, tags, etc.
Route
:host/:formId/settings
Code
Template HTML
The component shown to a user when a form has been changed and the user attempts to navigate away from the form context. It allows them to either cancel the navigation away, or cancel their form changes.
Route
:host/:formId/changes
Code
Template HTML
This component is shown to the user when a form conflict has been identified between the form being saved to the server and the form that already exists on the server (meaning that someone has saved the form before the user saved their version).
Route
:host/:formId/conflict
Code
Template HTML
The component used to ask the user if they wish to Delete the form, and if they confirm, performs the deletion of the form.
Route
:host/:formId/delete
Code
Template HTML
Provides an index of the submissions for a provided form context
Route
:host/:formId/submission
Code
Template HTML
The wrapper component for a Form Submission in context. Provides the navigation UI for the other child components such as view, edit, and delete.
Route
:host/form/:formId/submission/:submissionId
Code
Template HTML
The view component to view an existing submissions within a form.
Route
:host/form/:formId/submission/:submissionId
Code
Template HTML
The component used to allow the user to edit an existing submission.
Route
:host/form/:formId/submission/:submissionId/edit
Code
Template HTML
The component that provides an interface to the user to ask them if they wish to delete a submission or not.
Route
:host/form/:formId/submission/:submission/delete
Code
Template HTML
A suitable application is available. This walkthrough uses the sample Angular application created in the procedure in the Developer Guide.
Ensure that all styles added to the application are supported by the Enterprise Form Builder Module. By default, the Enterprise Form Builder Module supports. To change the CSS template, extend the components (documented further below). To enable Bootstrap, install it within the application as follows:
This uses to offer multiple themes. Alter the theme by changing the word "cosmo" to the preferred theme.
Enter the title Form Builder and click Create Role. Refer to for additional information.
Configure the Project to add these roles to the authenticated users group. Do this using the , or using . Either option requires modifying the User Login form to enable this authentication.
The documentation for setting up Authentication within an Angular application can be found at the .
Typically, each application will have its own "alert" notification systems. For example, an application may chose to use with their applications when a notification is made. The Enterprise Form Builder Module provides a way to inject alerts generated by the Enterprise Form Builder Module into the host application's notification system. To do so, refer to the following example steps:
If not data is visible, or the table is stuck loading, make sure that the appropriate are set within the form.
Open a new browser tab and copy the existing HTML template found in the FormViewComponent by starting with the code available on the Form.io GitHub: