LogoLogo
Try it outResourcesAPIsAddOnsBook a demo
  • Getting Started
    • Introduction to Beefree SDK
      • Create an Application
      • Installation and Fundamentals
        • Configuration parameters
          • Configuration Reload
          • Workspaces
          • Debugging the Beefree SDK Editor
        • Methods and Events
        • Authorization Process
        • How the UID parameter works
        • Set up two-factor authentication
        • Naming conventions
      • Development Applications
      • Manage Users
      • Manage Subscriptions
    • Tracking Message Changes
    • Sample Code
    • Release Candidate Environment
  • Visual Builders
    • Email Builder
    • Page Builder
      • Integrating Page Builder
      • Embedding videos in a page
    • Popup Builder
      • Popup Builder - Getting Started
      • Testing and Integrating
      • Setting layout and size
        • Advanced settings
    • AI-Driven Design Creation
  • APIs
    • Content Services API
      • Authentication
      • Export
      • Convert
      • Row Processing
      • AI Collection
      • Brand Style
      • Check
    • Template Catalog API
      • Authentication
      • Templates
      • Categories
      • Collections
      • Designers
      • Tags
    • HTML Importer API
      • Authentication
      • Import HTML
  • Forms
    • Form Block
    • Integrating and using the Form block
      • Passing forms to the builder
      • Form structure and parameters
      • Form layout customization
      • Allowed form fields
      • Edit form field modal
  • Rows
    • Reusable Content
      • Create Reusable Content
        • Pre-build Reusable Content
          • Implement Custom Rows
        • Save Reusable Content
          • Implement Hosted Saved Rows
          • Implement Self-hosted Saved Rows
            • Self-hosted Saved Rows Concepts and Tutorial
      • Sync Reusable Content
        • Implement Synced Rows
        • Initialize Edit Single Row Mode
      • Manage Reusable Content
    • Storage for Reusable Content
      • Hosted Saved Rows
      • Self-Hosted Saved Rows
  • File manager
    • File manager application overview
      • Mime Types and Groups
  • Server-side configurations
    • Server-side options
      • Toolbar options
      • Storage options
        • Configure your AWS S3 bucket
        • Connect your file storage system
      • Content options
      • Services options
      • Undo & Changes history
      • Custom JavaScript Libraries Injection
  • Other Customizations
    • Advanced options
      • Special Links and Merge Tags
      • Content Dialog
      • Custom Color Palette
      • Font management
      • Roles and Permissions
      • Smart Merge Tags
      • Commenting
      • Custom Attributes
      • Meta Tags
      • Custom Languages
      • Display Conditions
      • Advanced Permissions
      • Custom File Picker
      • Custom Headers
    • Appearance
      • Content Defaults
      • Custom Sidebar Position
      • Content Tile Sorting
      • Content Tile Grouping
      • Loading Spinner Theme
      • Custom Tab Layout
      • Themes
      • Custom CSS
        • Change Log
    • AMP for Email
    • Collaborative Editing
      • Co-editing Integration Guide
    • Mobile Design Mode
    • Multi-language Templates
    • Cards Style and Image Round Corners
    • Hover Effect for Buttons
    • Content Area Padding
    • Line Height
    • Frontend Commands
  • Data Structures
    • Getting Started
    • Schema Catalog
    • Simple Schema
      • Template Schema
      • Definitions Schema
      • Row Schema
      • Column Schema
      • Title Schema
      • Image Schema
      • Button Schema
      • Paragraph Schema
      • HTML Schema
      • Menu Schema
      • List Schema
      • Icon Schema
      • Divider Schema
    • Row Metadata
    • Form Validation Schema
    • Comments Schema
      • Change Schema for Comments
  • Builder AddOns
    • AddOns
      • AddOns Overview
      • Partner AddOns
        • Partner AddOns directory
        • Installing Partner AddOns
        • DeepL
        • Stability AI
        • Azure AI Vision - Image Analysis
          • Alternate Text Generation with AI
          • AI Alt Text Bulk Generation
        • AI Writing Assistant
          • Available Providers
            • OpenAI
            • Azure OpenAI
            • Anthropic
          • AI Providers and Data Security
          • AI-Generated Meta Tag Fields
          • Token Upselling
          • Apply a Brand Tone
        • Custom AI Writing Assistant
      • Custom AddOns
        • AddOn Development
        • Contribute to the Partner AddOn Marketplace
      • AddOns Configuration
      • AddOn FAQs
  • Resources
    • Error Management
      • onWarning
      • Beefree SDK Editor Errors
      • File System Provider errors
      • JSON Parser errors
      • Template Validation and Update
      • Template validation and update errors
    • Scheduled maintenances
Powered by GitBook
LogoLogo

Policies

  • Privacy & Cookies
  • Terms of Services
  • GDPR Compliance
  • Trust Center

Contact Us

  • Submit a request
  • Book a demo
  • Report a security issue
  • Beefree SDK Startup Program

Resources

  • Developer website
  • Create a Developer Account

© Bee Content Design, Inc. San Francisco, CA | Part of Growens

On this page
  • Introduction
  • Schema Overview
  • Structure Definition
  • Field Descriptions
  • Usage Example
  • Additional Considerations

Was this helpful?

Export as PDF
  1. Data Structures

Form Validation Schema

Introduction

Schemas are structured definitions that describe the format, rules, and relationships of data within a system. They ensure consistency and validate inputs. The Form Schema defines the structure and properties of form elements, including fields, layouts, and attributes. This documentation breaks down the schema’s properties, usage examples, and key considerations for implementation.

Schema Overview

This section summarizes the purpose and key characteristics of the Form Schema.

Schema Name: Form Schema Purpose: Defines the structure of forms, including fields, layouts, and form-level attributes. Mandatory Fields: fields Related Schemas:

  • Used alongside field-specific schemas to define input types and their properties.

Structure Definition

Reference the Beefree SDK validation schema in GitHub for the full list of properties.

Field Descriptions

The following table lists the field descriptions along with their corresponding data type, whether or not they are mandatory, and their description.

Property
Type
Required
Description

title

string

No

The title of the form.

description

string

No

A description of the form.

fields

object

Yes

Defines the form fields and their properties.

layout

array

No

Specifies the arrangement of fields in the form.

attributes

object

No

Form-level attributes (e.g., action, method, enctype).

fields Property

  • Type: Object with dynamic keys matching the pattern ^[a-zA-Z0-9_-]+$.

  • Each field must include:

    • type (string, required): The input type (e.g., text, email, checkbox).

    • label (string, optional): The display label for the field.

    • canBeRemovedFromLayout (boolean, optional): Whether the field can be removed from the layout.

    • removeFromLayout (boolean, optional): Whether the field is excluded from the layout.

    • attributes (object, optional): Field-specific HTML attributes.

    • options (object/array, optional): Used for fields like select, radio, etc.

layout Property

  • Type: Array of arrays or objects.

  • Defines the visual arrangement of fields.

  • Can include:

    • Simple arrays of field names (e.g., ["field1", "field2"]).

    • Objects with legend (string) and fields (array of arrays) for grouped sections.

attributes Property

  • Type: Object.

  • Defines form-level HTML attributes.

  • Required: action (string).

  • Other optional properties include method, enctype, target, etc.

Usage Example

This section demonstrates a comprehensive auto loan pre-approval form definition that showcases the full capabilities of the form specification. The example includes various field types, layout configurations, and form attributes to illustrate a real-world implementation.

Auto Loan Pre-Approval Form Example

The following example represents a complete auto loan application form, featuring:

  • Multiple field types (text, select, radio, number, submit)

  • Required field validation

  • Conditional layout controls

  • Comprehensive form attributes

  • Demonstration of all supported HTML input types (even those hidden from the main layout)

var autoLoanForm = {
  structure: {
    title: 'Auto Loan Pre-Approval',
    description: 'Check if you\'re pre-approved for an auto loan with Modern Bank.',
    fields: {
      full_name: {
        type: 'text',
        label: 'Full Name *',
        canBeRemovedFromLayout: true,
        removeFromLayout: false,
        canBeModified: true,
        attributes: {
          required: true,
          placeholder: 'Enter your full name',
        },
      },
      credit_score_range: {
        type: 'select',
        label: 'Credit Score Range *',
        canBeRemovedFromLayout: false,
        removeFromLayout: false,
        attributes: {
          required: true,
        },
        options: [
          { type: 'option', label: '300-579', value: '300-579' },
          { type: 'option', label: '580-669', value: '580-669' },
          { type: 'option', label: '670-739', value: '670-739' },
          { type: 'option', label: '740-799', value: '740-799' },
          { type: 'option', label: '800-850', value: '800-850' },
        ],
      },
      car_make_model: {
        type: 'text',
        label: 'Car Make and Model *',
        canBeRemovedFromLayout: false,
        removeFromLayout: false,
        attributes: {
          required: true,
          placeholder: 'Enter car make and model',
        },
      },
      loan_amount: {
        type: 'number',
        label: 'Loan Amount Requested *',
        canBeRemovedFromLayout: false,
        removeFromLayout: false,
        attributes: {
          required: true,
          min: 0,
          placeholder: 'Enter loan amount',
        },
      },
      car_type: {
        type: 'radio',
        label: 'New or Used Car *',
        canBeRemovedFromLayout: false,
        removeFromLayout: false,
        attributes: {
          required: true,
        },
        options: [
          { type: 'option', label: 'New', value: 'new' },
          { type: 'option', label: 'Used', value: 'used' },
        ],
      },
      // ... [rest of the form definition]
    },
    layout: [
      ['full_name'],
      ['credit_score_range'],
      ['car_make_model'],
      ['loan_amount'],
      ['car_type'],
      ['submit_button'],
      // Hidden fields demonstration
      ['number'],
      ['longtext'],
      ['datalist'],
      // ... [other hidden fields]
    ],
    attributes: {
      'accept-charset': 'UTF-8',
      action: 'http://example.com/read-form-script',
      autocomplete: 'on',
      enctype: 'multipart/form-data',
      method: 'post',
      novalidate: false,
      target: '_self',
    },
  },
};

Structure Object Breakdown

The structure object contains all form configuration elements:

  1. Metadata:

    • title: Form header displayed to users

    • description: Explanatory text about the form's purpose

  2. Fields Configuration:

    • Each field has type-specific properties and attributes

    • Includes layout control flags (canBeRemovedFromLayout, removeFromLayout)

    • Supports all HTML input types (demonstrated in hidden fields)

    • Required field validation through attributes

  3. Layout Management:

    • The layout array defines the visual organization of fields

    • Supports multi-column layouts through nested arrays

    • Hidden fields are included in definition but removed from display

  4. Form Attributes:

    • Comprehensive HTML form attributes

    • Supports modern features like charset declaration and autocomplete

    • Configurable submission handling (method, enctype, target)

Additional Considerations

Consider the following when using the Form Schema:

  • Dynamic Fields: Use patternProperties to validate field names.

  • Extensibility: Custom attributes can be added under data-* patterns.

  • Layout Flexibility: Use arrays or objects in layout for simple or grouped arrangements.

PreviousRow MetadataNextComments Schema

Last updated 2 months ago

Was this helpful?