Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Usage Milestone: Time Field for Drupal 8+ Module time_field crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Content Save Confirm box

No security coverage Drupal 10–11
View on drupal.org

This module adds a configurable confirmation dialog to Drupal forms, preventing accidental content saves. It allows administrators to specify which forms should display the confirmation and customize the message, while only affecting save buttons on targeted forms.

Description

The **Content Save Confirm** module adds a configurable confirmation dialog when saving content forms in Drupal. This module helps prevent accidental content submissions by requiring users to confirm their save action before the form is actually submitted.

Key Features

- **Configurable Form IDs**: Administrators can specify exactly which forms should display confirmation dialogs
- **Custom Confirmation Messages**: Set your own confirmation message text
- **Smart Button Detection**: Only affects save/submit buttons, not preview, delete, or cancel buttons
- **Easy Administration**: Simple configuration interface accessible from the admin menu
- **No Database Changes**: Uses Drupal's configuration system - no additional database tables required
- **Drupal 10 & 11Compatible**: Built specifically for Drupal 10 & 11 with modern JavaScript practices

Use Cases

- **Content Management**: Prevent accidental publishing of articles, pages, or other content types
- **User Registration**: Add confirmation for user registration forms
- **Important Forms**: Any form where accidental submission could cause issues
- **Editorial Workflow**: Extra safety layer for content editors and administrators

Installation

Via Composer (Recommended)
```bash
composer require drupal/content_save_confirm
```

Manual Installation
1. Download and extract the module to `modules/custom/content_save_confirm/`
2. Enable the module via Drush: `drush en content_save_confirm`
3. Or enable via admin UI: Extend → Check "Content Save Confirm" → Install

Configuration

1. Navigate to **Administration → Configuration → Content → Content Save Confirm**
2. Set your confirmation message (default: "Are you sure you want to save this content?")
3. Add form IDs (one per line) where you want confirmation dialogs to appear

Common Form IDs

- `node_article_form` - Article creation form
- `node_article_edit_form` - Article edit form
- `node_page_form` - Page creation form
- `node_page_edit_form` - Page edit form
- `user_register_form` - User registration form
- `user_form` - User profile edit form

Finding Form IDs

The module includes helpful documentation on how to find form IDs for your specific content types and forms. Common methods include:

1. **Enable logging**: The module logs all form IDs it encounters
2. **Browser developer tools**: Inspect form elements for IDs and selectors
3. **Devel module**: Use `dpm($form_id)` in hook_form_alter()

How It Works

1. The module uses `hook_form_alter()` to attach JavaScript to specified forms
2. JavaScript intercepts submit button clicks on configured forms
3. A native browser confirmation dialog appears before form submission
4. Form only submits if user confirms the action
5. Preview, delete, and cancel buttons are automatically excluded

Technical Details

- **Dependencies**: Drupal Core 10 & 11
- **JavaScript Libraries**: Uses core/jquery, core/drupal, core/once
- **Configuration Storage**: Drupal configuration system
- **No External Dependencies**: Pure Drupal core functionality

Browser Compatibility

Works with all modern browsers that support:
- JavaScript `confirm()` dialogs
- jQuery event handling
- Modern Drupal JavaScript practices

Troubleshooting

### Dialog Not Appearing?
1. Check that the correct form IDs are configured
2. Clear Drupal caches
3. Verify JavaScript console for any errors
4. Check that the module is properly enabled

### Finding the Right Form ID?
1. Enable the module's logging feature
2. Visit `/admin/reports/dblog` after accessing your forms
3. Look for "content_save_confirm" log entries showing form IDs

## Development and Support

- **Issue Queue**: Report bugs and request features on the project issue queue
- **Code Repository**: Available on Drupal.org with Git access
- **Documentation**: Comprehensive README and inline code documentation
- **Community Support**: Active maintenance and community contributions welcome

Maintainers

- Rahul Yadav - 5418ryadav

---

**Tags**: confirmation, dialog, form, save, content, prevent, accidental, safety, workflow, editorial

Depends on

Dependencies of the latest stable release

  • system Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Jun 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 4
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
1.0.3 Stable 10–11 Jun 22, 2025
1.0.2 Stable 10 Jun 22, 2025
1.0.1 Stable 10 Jun 21, 2025
1.0.x-dev Dev 10 Jun 21, 2025