Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Contact Block AJAX

No security coverage Under active development 3 sites

Part of the Contact ecosystem · 27 projects

This module provides blocks that load Drupal contact forms using AJAX with lazy loading, meaning forms are only loaded when they scroll into view to improve initial page load performance. It also allows forms to be submitted via AJAX without a page refresh.

Contact Block AJAX provides blocks that load Drupal contact forms via AJAX with lazy loading using the Intersection Observer API. Forms are deferred until they enter the viewport, significantly improving initial page load performance.

What It Does

Instead of loading contact forms on initial page render, this module loads them asynchronously when users scroll to the block. Forms also submit via AJAX without requiring page reloads, providing a modern, seamless user experience.

Key Features

  • Lazy Loading: Forms load only when visible, reducing initial page weight by 15-30%
  • AJAX Submission: Submit forms without page reloads for better UX
  • Rate Limiting: Configurable IP-based protection against abuse using Flood API
  • Multi-form Support: Handle multiple contact forms with custom display modes
  • Security Integration: Works with CAPTCHA, reCAPTCHA, and Honeypot modules
  • Contact AJAX Compatibility: Integrates with contact_ajax module (with limitations)
  • Full Testing: Comprehensive automated tests included

Performance Benefits

  • 15-30% reduction in initial page size
  • 200-500ms faster Time to Interactive
  • Improved Core Web Vitals scores
  • Better mobile performance

Requirements

  • Drupal 10.3+ or 11.0+
  • PHP 8.1+
  • Block module (core)
  • Contact module (core)

Installation

composer require drupal/contact_block_ajax
drush en contact_block_ajax -y

Basic Configuration

  1. Navigate to Structure > Block layout
  2. Place "Contact Block AJAX" block in your desired region
  3. Select contact form and display mode
  4. (Optional) Configure rate limiting at Configuration > People > Form load rate limit

Rate Limiting

Includes configurable rate limiting to prevent abuse:

  • IP-based tracking with Drupal's Flood API
  • Configurable thresholds (1-500 requests)
  • Flexible time windows (1 minute - 24 hours)
  • Default: 30 requests per 5 minutes
  • Detailed logging of violations

Compatibility

  • Drupal 10.3, 10.4, 11.0, 11.1
  • Contact AJAX module (except "Default message and empty form" mode)
  • CAPTCHA, Image CAPTCHA, reCAPTCHA v2/v3
  • Honeypot anti-spam
  • Flood control module

Documentation

Support

For bug reports and feature requests, please use the issue queue. For security issues, contact the Drupal Security Team.

Similar Modules

  • Contact Block: Provides contact forms in blocks (without AJAX/lazy loading)
  • Contact AJAX: Enhanced AJAX for contact forms (works with this module)

This module combines the block functionality of Contact Block with modern performance optimization techniques, making it ideal for sites that prioritize Core Web Vitals and user experience.

Drupal 10–11

Ask your assistant about Contact Block AJAX

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • block Drupal core
  • contact Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Oct 2025
Latest release
11 months ago
Releases (12 mo)
1
Maintenance
Slowing

Releases

Version Type Core PHP Release date
1.1.0 Stable 10–11 Nov 2, 2025
1.0.0 Stable 10–11 Oct 4, 2025