What is Form module
The Form module is part of the Proview SDK, exposed asProview.form. It provides a complete solution for loading, rendering, and managing dynamic forms with integrated authentication.
Once initialized, it lets your application:
- Load forms — render forms dynamically by form ID.
- Submit forms — handle form submission and validation automatically.
- Mount UI — display forms in
sidepanel,popup, orinlinelayout modes. - React to events — subscribe to ready, submitted, and error events.
Quickstart
1. Load the SDK
Ensure the Proview SDK script is loaded (see Getting Started).2. Initialize credential
The SDK supports Firebase as a credentialing provider for authentication.3. Initialize form module
Initialize the form module with the Firebase credential.4. Access user object
Once initialized, the user object becomes available globally atProview.user and is Firebase-compatible with getIdToken() method.
5. Mount UI
Mount the form UI into a container element.6. Open form
Open the form to load data and display the UI.7. Subscribe to events
Listen to form lifecycle events.8. Teardown
When done, unmount the UI.API Reference
Proview.form.init(options)
Creates a form module instance with integrated authentication.
Input
FormModule
Proview.user after initialization.
form.mount(options)
Mounts the form UI into a container element.
| Input | MountOptions |
| Returns | MountedFormUi |
form.open()
Loads form data and displays the form UI. Uses the formId specified in mount().
| Input | None |
| Promise | Promise<FormInstance> |
| Async | Yes, requires await |
User Object
After initializing the form module,Proview.user provides a Firebase-compatible user object accessible globally.
User Interface
Firebase Authentication
Proview.auth.FirebaseAuthStrategy(config)
Creates a Firebase authentication credential for use with the Proview SDK modules.
Input
FirebaseAuthStrategy
A credential object that can be passed to any Proview SDK module initialization.
Example:
Form Events
TheFormInstance emits events that you can subscribe to using the on() method.
Event names and payloads
| Event | Payload | Description |
|---|---|---|
ready | void | Form loaded and ready |
submitted | void | Form submitted successfully |
error | { message: string } | Error occurred |
Mount Modes
The form module supports three layout modes for the form UI.| Mode | Value | Behavior |
|---|---|---|
| Sidepanel | 'sidepanel' | Slides in from side of viewport |
| Popup | 'popup' | Centered modal overlay |
| Inline | 'inline' | Embedded in the page flow |
Error Handling
Form errors follow a consistent structure. Error Structure| Code | Description |
|---|---|
FORM_LOAD_ERROR | Failed to load form |
PANEL_ERROR | Panel rendering error |
TOKEN_INVALID | Authentication token is invalid |
TOKEN_EXPIRED | Session token expired |
AUTH_FAILED | Authentication failed |
FETCH_FAILED | Network or API request failed |

