Create a Form Library in Beefree SDK
Learn how to create a form library with multiple pre-built forms that users can select and drag into their Beefree SDK email designs through a modal interface.
Why Create a Form Library?
Instead of limiting users to a single default form, a form library provides the best of both worlds. Users can choose from a curated collection of pre-built, industry-specific forms that are ready to use and fully customizable.
A form library is perfect when you want to:
Offer multiple form templates for different use cases (contact, survey, application, etc.)
Provide industry-specific forms (auto loans, mortgages, credit cards, etc.)
Maintain consistent branding across form types
Speed up form creation with pre-configured field validation and layouts
With Beefree SDK's contentDialog.manageForm handler, you can create a modal selection interface that integrates with Beefree SDK's editor.
Project Map: Where to Look in the Sample Project
This recipe is based on the beefree-sdk-form-block-demo GitHub project. Clone it, then explore these key files:
Complete form library implementation
How to create multiple pre-defined forms with a selection modal
Authentication proxy server
How to handle secure Beefree SDK authentication with LoginV2
Data Flow Diagram
Here's how the form library integrates with Beefree SDK:
Why this flow? Beefree SDK triggers the form library through the contentDialog, and end users select a pre-built form from the list of available forms within the custom modal. The chosen structure is returned as JSON, and then integrated into the page or popup design.
Step 1: Clone and Setup
Clone the repository and install dependencies:
Create your .env file with Beefree SDK credentials:
Step 2: Form Library Modal Structure
File to reference: form-library-example.html (lines 144-152)
The form library uses a simple modal interface with buttons for each available form:
Step 3: Pre-Built Form Definitions
File to reference: form-library-example.html (lines 233-810)
Each form in the library is a complete form structure object. Here's the Auto Loan form example:
Step 4: Content Dialog Integration
File to reference: form-library-example.html (lines 852-878)
The key integration point is the contentDialog.manageForm handler with form selection logic:
Step 5: Form Selection Logic
File to reference: form-library-example.html (lines 857-875)
The selectForm() function handles user selection and returns the appropriate form structure:
Step 6: Multiple Form Definitions
The library includes three complete form examples, each tailored for different use cases:
Auto Loan Pre-Approval Form
Full name (text input)
Credit score range (select dropdown)
Car make and model (text input)
Loan amount (number input)
New or used car (radio buttons)
Submit button
Mortgage Pre-Approval Form
Credit Card Application Form
Full name (text input)
Credit score range (select dropdown)
Credit card product (select dropdown)
Credit limit requested (number input)
Submit button
Step 7: Modal Management
File to reference: form-library-example.html (lines 957-964)
Simple modal controls for the form selection interface:
Step 8: Default Form Configuration
File to reference: form-library-example.html (line 880)
Set which form appears by default when users first drag a form block:
Step 9: Enhanced Form Library Structure
For a more robust form library, you can organize forms by category:
Step 10: Advanced Modal Interface
Create a more sophisticated selection interface with categories and previews:
Step 11: Form Validation and Customization
Add validation to ensure form integrity before selection:
Step 12: Running the Form Library
Start the proxy server:
Open
form-library-example.htmlin your browser:SDK loads with authentication via the proxy
Drag a form block onto the design stage
Click "Edit Form" to open the form library modal
Select a form type from the available options
Form integrates automatically into your email design
Customize as needed using Beefree SDK's form editing tools
Step 13: CSS Styling for Professional Appearance
File to reference: form-library-example.html (lines 38-130)
The form library includes professional styling for the modal interface:
Advanced Features
You can build upon your integration and also add the following and more to further customize your end user's experience:
Dynamic Form Loading: Load forms from an external API or database:
Form Search and Filtering: Add search functionality to large form libraries:
Form Analytics: Track which forms are most popular:
Learn More
Full example project: beefree-sdk-form-block-demo
API docs: Form Block Integration
Content Dialogs: Custom Dialog Handlers
Implementation Checklist
Define multiple form structures with complete field definitions
Create modal selection interface with form options
Configure
contentDialog.manageFormhandler for SDK integrationImplement form selection logic with proper validation
Set default form for initial drag-and-drop experience
Style the interface for professional appearance
Test complete workflow from selection to email integration
Consider advanced features like categories, search, and analytics
Clone the example project, explore the form-library-example.html file, and customize the form library to match your specific industry needs. Your users will have quick access to professional, pre-built forms that can be easily integrated into their email campaigns.
Last updated
Was this helpful?

